public class TransactionImpl extends Object implements Transaction
Transaction.State
Constructor and Description |
---|
TransactionImpl(TransactionManagerServiceImpl transactionManagerService,
NodeEngine nodeEngine,
TransactionOptions options,
String txOwnerUuid) |
TransactionImpl(TransactionManagerServiceImpl transactionManagerService,
NodeEngine nodeEngine,
TransactionOptions options,
String txOwnerUuid,
boolean originatedFromClient) |
public TransactionImpl(TransactionManagerServiceImpl transactionManagerService, NodeEngine nodeEngine, TransactionOptions options, String txOwnerUuid)
public TransactionImpl(TransactionManagerServiceImpl transactionManagerService, NodeEngine nodeEngine, TransactionOptions options, String txOwnerUuid, boolean originatedFromClient)
public String getTxnId()
getTxnId
in interface Transaction
public long getStartTime()
public String getOwnerUuid()
getOwnerUuid
in interface Transaction
public boolean isOriginatedFromClient()
isOriginatedFromClient
in interface Transaction
public Transaction.State getState()
getState
in interface Transaction
public long getTimeoutMillis()
getTimeoutMillis
in interface Transaction
protected TransactionLog getTransactionLog()
public void add(TransactionLogRecord record)
add
in interface Transaction
public TransactionLogRecord get(Object key)
get
in interface Transaction
public void remove(Object key)
remove
in interface Transaction
public void begin() throws IllegalStateException
begin
in interface Transaction
IllegalStateException
public void prepare() throws TransactionException
prepare
in interface Transaction
TransactionException
public boolean requiresPrepare()
Preparing a transaction costs time since the backup log potentially needs to be copied and each logrecord needs to prepare its content (e.g. by acquiring locks). This takes time.
If a transaction is local or if there is 1 or 0 items in the transaction log, instead of preparing, we are just going to try to commit. If the lock is still acquired, the write succeeds, and if the lock isn't acquired, the write fails; this is the same effect as a prepare would have.
prepare()
is required.public void commit() throws TransactionException, IllegalStateException
commit
in interface Transaction
TransactionException
IllegalStateException
public void rollback() throws IllegalStateException
rollback
in interface Transaction
IllegalStateException
public void ensureBackupLogsExist()
Not every data-structure, e.g. the Transactional Map, relies on it and in some cases can even skip it.
protected CreateTxBackupLogOperation createCreateTxBackupLogOperation()
protected ReplicateTxBackupLogOperation createReplicateTxBackupLogOperation()
protected RollbackTxBackupLogOperation createRollbackTxBackupLogOperation()
protected PurgeTxBackupLogOperation createPurgeTxBackupLogOperation()
public TransactionOptions.TransactionType getTransactionType()
getTransactionType
in interface Transaction
Copyright © 2019 Hazelcast, Inc.. All Rights Reserved.