Class TransactionImpl
- java.lang.Object
-
- org.apache.activemq.artemis.core.transaction.impl.TransactionImpl
-
- All Implemented Interfaces:
Transaction
- Direct Known Subclasses:
BindingsTransactionImpl
public class TransactionImpl extends Object implements Transaction
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.activemq.artemis.core.transaction.Transaction
Transaction.State
-
-
Field Summary
Fields Modifier and Type Field Description protected StorageManagerstorageManager
-
Constructor Summary
Constructors Constructor Description TransactionImpl(long id, Xid xid, StorageManager storageManager)TransactionImpl(Xid xid, StorageManager storageManager, int timeoutSeconds)TransactionImpl(StorageManager storageManager)TransactionImpl(StorageManager storageManager, int timeoutSeconds)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddOperation(TransactionOperation operation)protected voidafterCommit(List<TransactionOperation> operationsToComplete)voidafterStore(TransactionOperation sync)This is an operation that will be called right after the storage is completed.voidcommit()voidcommit(boolean onePhase)RefsOperationcreateRefsOperation(Queue queue, AckReason reason)protected voiddoCommit()protected voiddoRollback()List<TransactionOperation>getAllOperations()longgetCreateTime()longgetID()ObjectgetProperty(int index)ObjectgetProtocolData()Transaction.StategetState()XidgetXid()booleanhasTimedOut()To validate if the Transaction had previously timed out.booleanhasTimedOut(long currentTime, int defaultTimeout)booleanisContainsPersistent()booleanisEffective()voidmarkAsRollbackOnly(ActiveMQException exception)voidprepare()voidputProperty(int index, Object property)voidresume()voidrollback()voidsetContainsPersistent()voidsetProtocolData(Object protocolData)Protocol managers can use this field to store any object needed.voidsetState(Transaction.State state)voidsetTimeout(int timeout)voidsuspend()StringtoString()booleantryRollback()In a ServerSession failure scenario,\ we may try to rollback, however only if it's not prepared.
-
-
-
Field Detail
-
storageManager
protected final StorageManager storageManager
-
-
Constructor Detail
-
TransactionImpl
public TransactionImpl(StorageManager storageManager, int timeoutSeconds)
-
TransactionImpl
public TransactionImpl(StorageManager storageManager)
-
TransactionImpl
public TransactionImpl(Xid xid, StorageManager storageManager, int timeoutSeconds)
-
TransactionImpl
public TransactionImpl(long id, Xid xid, StorageManager storageManager)
-
-
Method Detail
-
getProtocolData
public Object getProtocolData()
- Specified by:
getProtocolDatain interfaceTransaction
-
setProtocolData
public void setProtocolData(Object protocolData)
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
public RefsOperation createRefsOperation(Queue queue, AckReason reason)
- 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
public void prepare() throws Exception- Specified by:
preparein interfaceTransaction- Throws:
Exception
-
commit
public void commit() throws Exception- Specified by:
commitin interfaceTransaction- Throws:
Exception
-
commit
public void commit(boolean onePhase) throws Exception- Specified by:
commitin interfaceTransaction- 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
public void rollback() throws Exception- Specified by:
rollbackin interfaceTransaction- Throws:
Exception
-
suspend
public void suspend()
- Specified by:
suspendin interfaceTransaction
-
resume
public void resume()
- Specified by:
resumein interfaceTransaction
-
getState
public Transaction.State getState()
- Specified by:
getStatein interfaceTransaction
-
setState
public void setState(Transaction.State state)
- Specified by:
setStatein interfaceTransaction
-
getXid
public Xid getXid()
- Specified by:
getXidin interfaceTransaction
-
markAsRollbackOnly
public void markAsRollbackOnly(ActiveMQException exception)
- Specified by:
markAsRollbackOnlyin interfaceTransaction
-
addOperation
public void addOperation(TransactionOperation operation)
- Specified by:
addOperationin interfaceTransaction
-
afterStore
public void afterStore(TransactionOperation sync)
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
public List<TransactionOperation> getAllOperations()
- Specified by:
getAllOperationsin interfaceTransaction
-
putProperty
public void putProperty(int index, Object property)- Specified by:
putPropertyin interfaceTransaction
-
getProperty
public Object getProperty(int index)
- Specified by:
getPropertyin interfaceTransaction
-
afterCommit
protected void afterCommit(List<TransactionOperation> operationsToComplete)
-
-