Class TransactionImpl
java.lang.Object
org.apache.activemq.artemis.core.transaction.impl.TransactionImpl
- All Implemented Interfaces:
Transaction
- Direct Known Subclasses:
BindingsTransactionImpl
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.activemq.artemis.core.transaction.Transaction
Transaction.State -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanprotected final longprotected Transaction.Stateprotected final StorageManagerprotected final Xid -
Constructor Summary
ConstructorsConstructorDescriptionTransactionImpl(long id, Xid xid, StorageManager storageManager) TransactionImpl(Xid xid, StorageManager storageManager, int timeoutSeconds) TransactionImpl(StorageManager storageManager) TransactionImpl(StorageManager storageManager, int timeoutSeconds) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddOperation(TransactionOperation operation) protected voidafterCommit(List<TransactionOperation> operationsToComplete) voidThis is an operation that will be called right after the storage is completed. addOperation could only happen after paging and replication, while these operations will just be about the storagevoidafterWired(Runnable callback) voidcommit()voidcommit(boolean onePhase) createRefsOperation(Queue queue, AckReason reason) voiddelay()Calling this will defer the storage of the commit or prepare until delayDone is called.voidThis is to be called when the delay portion is done.protected voiddoCommit()protected voidlonglonggetID()intgetProperty(int index) protected OperationConsistencyLevelgetState()getXid()booleanTo validate if the Transaction had previously timed out.booleanhasTimedOut(long currentTime, int defaultTimeout) booleanisAsync()booleanbooleanvoidmarkAsRollbackOnly(ActiveMQException exception) voidprepare()voidputProperty(int index, Object property) voidresume()voidrollback()setAsync(boolean async) To be used on control transactions that are meant as internal and don't really require a hard sync.voidvoidsetProtocolData(Object protocolData) Protocol managers can use this field to store any object needed.voidsetState(Transaction.State state) voidsetTimeout(int timeout) voidsuspend()toString()booleanIn a ServerSession failure scenario,\ we may try to rollback, however only if it's not prepared.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.activemq.artemis.core.transaction.Transaction
isAllowPageTransaction
-
Field Details
-
storageManager
-
xid
-
id
protected final long id -
state
-
containsPersistent
protected volatile boolean containsPersistent
-
-
Constructor Details
-
TransactionImpl
-
TransactionImpl
-
TransactionImpl
-
TransactionImpl
-
-
Method Details
-
isAsync
public boolean isAsync()- Specified by:
isAsyncin interfaceTransaction
-
setAsync
Description copied from interface:TransactionTo be used on control transactions that are meant as internal and don't really require a hard sync.- Specified by:
setAsyncin interfaceTransaction
-
getProtocolData
- Specified by:
getProtocolDatain interfaceTransaction
-
setProtocolData
Description copied from interface:TransactionProtocol managers can use this field to store any object needed. An example would be the Session used by the transaction on openwire- Specified by:
setProtocolDatain interfaceTransaction
-
isEffective
public boolean isEffective()- Specified by:
isEffectivein interfaceTransaction
-
setContainsPersistent
public void setContainsPersistent()- Specified by:
setContainsPersistentin interfaceTransaction
-
isContainsPersistent
public boolean isContainsPersistent()- Specified by:
isContainsPersistentin interfaceTransaction
-
setTimeout
public void setTimeout(int timeout) - Specified by:
setTimeoutin interfaceTransaction
-
createRefsOperation
- Specified by:
createRefsOperationin interfaceTransaction
-
getID
public long getID()- Specified by:
getIDin interfaceTransaction
-
getCreateTime
public long getCreateTime()- Specified by:
getCreateTimein interfaceTransaction
-
hasTimedOut
public boolean hasTimedOut(long currentTime, int defaultTimeout) - Specified by:
hasTimedOutin interfaceTransaction
-
hasTimedOut
public boolean hasTimedOut()Description copied from interface:TransactionTo validate if the Transaction had previously timed out. This is to check the reason why a TX has been rolled back.- Specified by:
hasTimedOutin interfaceTransaction
-
prepare
- Specified by:
preparein interfaceTransaction- Throws:
Exception
-
commit
- Specified by:
commitin interfaceTransaction- Throws:
Exception
-
afterWired
- Specified by:
afterWiredin interfaceTransaction
-
getRequiredConsistency
-
commit
- Specified by:
commitin interfaceTransaction- Throws:
Exception
-
doCommit
- Throws:
Exception
-
tryRollback
public boolean tryRollback()Description copied from interface:TransactionIn a ServerSession failure scenario,\ we may try to rollback, however only if it's not prepared. In case it's prepared, we will just let it be and let the transaction manager to deal with it- Specified by:
tryRollbackin interfaceTransaction
-
rollback
- Specified by:
rollbackin interfaceTransaction- Throws:
Exception
-
suspend
public void suspend()- Specified by:
suspendin interfaceTransaction
-
resume
public void resume()- Specified by:
resumein interfaceTransaction
-
getState
- Specified by:
getStatein interfaceTransaction
-
setState
- Specified by:
setStatein interfaceTransaction
-
getXid
- Specified by:
getXidin interfaceTransaction
-
markAsRollbackOnly
- Specified by:
markAsRollbackOnlyin interfaceTransaction
-
delay
public void delay()Description copied from interface:TransactionCalling this will defer the storage of the commit or prepare until delayDone is called.- Specified by:
delayin interfaceTransaction
-
delayDone
public void delayDone()Description copied from interface:TransactionThis is to be called when the delay portion is done.- Specified by:
delayDonein interfaceTransaction
-
getPendingDelay
public int getPendingDelay() -
addOperation
- Specified by:
addOperationin interfaceTransaction
-
afterStore
Description copied from interface:TransactionThis is an operation that will be called right after the storage is completed. addOperation could only happen after paging and replication, while these operations will just be about the storage- Specified by:
afterStorein interfaceTransaction
-
getAllOperations
- Specified by:
getAllOperationsin interfaceTransaction
-
putProperty
- Specified by:
putPropertyin interfaceTransaction
-
getProperty
- Specified by:
getPropertyin interfaceTransaction
-
doRollback
- Throws:
Exception
-
afterCommit
-
toString
-