public class DetachedTxSystemClient extends Object implements TransactionSystemClient
| Constructor and Description |
|---|
DetachedTxSystemClient() |
| Modifier and Type | Method and Description |
|---|---|
void |
abort(Transaction tx)
Makes transaction visible.
|
boolean |
canCommit(Transaction tx,
Collection<byte[]> changeIds)
Checks if transaction with the set of changes can be committed.
|
Transaction |
checkpoint(Transaction tx)
Performs a checkpoint operation on the current transaction, returning a new Transaction instance with the
updated state.
|
boolean |
commit(Transaction tx)
Makes transaction visible.
|
int |
getInvalidSize() |
InputStream |
getSnapshotInputStream()
Retrieves the state of the transaction manager and send it as a stream.
|
boolean |
invalidate(long tx)
Makes transaction invalid.
|
void |
resetState()
Resets the state of the transaction manager.
|
Transaction |
startLong()
Starts new long transaction.
|
Transaction |
startShort()
Starts new short transaction.
|
Transaction |
startShort(int timeout)
Starts new short transaction.
|
String |
status()
Return the status of the transaction Manager
|
boolean |
truncateInvalidTx(Set<Long> invalidTxIds)
Removes the given transaction ids from the invalid list.
|
boolean |
truncateInvalidTxBefore(long time)
Removes all transaction ids started before the given time from invalid list.
|
public Transaction startShort()
TransactionSystemClientstartShort in interface TransactionSystemClientTransactionpublic Transaction startShort(int timeout)
TransactionSystemClientstartShort in interface TransactionSystemClienttimeout - the timeout for the transactionTransactionpublic Transaction startLong()
TransactionSystemClientstartLong in interface TransactionSystemClientTransactionpublic boolean canCommit(Transaction tx, Collection<byte[]> changeIds)
TransactionSystemClientTransactionSystemClient.commit(Transaction) which may check conflicts again to avoid races.
Since we do conflict detection at commit time as well, this may seem redundant. The idea is to check for conflicts
before we persist changes to avoid rollback in case of conflicts as much as possible.
NOTE: in some situations we may want to skip this step to save on RPC with a risk of many rollback ops. So by
default we take safe path.canCommit in interface TransactionSystemClienttx - transaction to verifychangeIds - ids of changes made by transactionpublic boolean commit(Transaction tx)
TransactionSystemClientTransactionSystemClient.canCommit(Transaction, java.util.Collection)commit in interface TransactionSystemClienttx - transaction to make visible.public void abort(Transaction tx)
TransactionSystemClientTransactionNotInProgressException if transaction has timed out.abort in interface TransactionSystemClienttx - transaction to make visible.public boolean invalidate(long tx)
TransactionSystemClientTransactionNotInProgressException if transaction has timed out.invalidate in interface TransactionSystemClienttx - transaction id to invalidate.public Transaction checkpoint(Transaction tx)
TransactionSystemClientcheckpoint in interface TransactionSystemClienttx - the current transaction to checkpointpublic InputStream getSnapshotInputStream() throws TransactionCouldNotTakeSnapshotException
TransactionSystemClientgetSnapshotInputStream in interface TransactionSystemClientTransactionCouldNotTakeSnapshotExceptionpublic String status()
TransactionSystemClientstatus in interface TransactionSystemClientpublic void resetState()
TransactionSystemClientresetState in interface TransactionSystemClientpublic boolean truncateInvalidTx(Set<Long> invalidTxIds)
TransactionSystemClienttruncateInvalidTx in interface TransactionSystemClientinvalidTxIds - transaction idspublic boolean truncateInvalidTxBefore(long time)
throws InvalidTruncateTimeException
TransactionSystemClienttruncateInvalidTxBefore in interface TransactionSystemClienttime - time in millisecondsInvalidTruncateTimeException - if there are any in-progress transactions started before given timepublic int getInvalidSize()
getInvalidSize in interface TransactionSystemClientCopyright © 2016 The Apache Software Foundation. All rights reserved.