Class TransactionImpl
java.lang.Object
org.apache.geronimo.transaction.manager.TransactionImpl
- All Implemented Interfaces:
javax.transaction.Transaction
Basic local transaction with support for multiple resources.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.apache.geronimo.transaction.manager.TransactionImpl.TransactionBranch
addBranchXid
(XAResource xaRes, Xid branchId) void
commit()
Complete the transaction represented by this Transaction object.boolean
delistResource
(XAResource xaRes, int flag) Disassociate the resource specified from the transaction associated with the target Transaction object.boolean
enlistResource
(XAResource xaRes) Enlist the resource specified with the transaction associated with the target Transaction object.boolean
getResource
(Object key) boolean
int
Obtain the status of the transaction associated with the target Transaction object.int
void
putResource
(Object key, Object value) void
registerInterposedSynchronization
(javax.transaction.Synchronization synchronization) void
registerSynchronization
(javax.transaction.Synchronization synch) Register a synchronization object for the transaction currently associated with the target object.void
rollback()
Rollback the transaction represented by this Transaction object.void
Modify the transaction associated with the target object such that the only possible outcome of the transaction is to roll back the transaction.void
setRollbackOnly
(Throwable reason)
-
Constructor Details
-
TransactionImpl
-
-
Method Details
-
getStatus
public int getStatus()Description copied from interface:javax.transaction.Transaction
Obtain the status of the transaction associated with the target Transaction object.- Specified by:
getStatus
in interfacejavax.transaction.Transaction
- Returns:
- The transaction status. If no transaction is associated with the target object, this method returns the Status.NoTransaction value.
-
getResource
-
getRollbackOnly
public boolean getRollbackOnly() -
getTransactionKey
-
getTransactionStatus
public int getTransactionStatus() -
putResource
-
registerInterposedSynchronization
public void registerInterposedSynchronization(javax.transaction.Synchronization synchronization) -
setRollbackOnly
Description copied from interface:javax.transaction.Transaction
Modify the transaction associated with the target object such that the only possible outcome of the transaction is to roll back the transaction.- Specified by:
setRollbackOnly
in interfacejavax.transaction.Transaction
- Throws:
IllegalStateException
- Thrown if the target object is not associated with any transaction.
-
setRollbackOnly
-
registerSynchronization
public void registerSynchronization(javax.transaction.Synchronization synch) throws IllegalStateException, javax.transaction.RollbackException, javax.transaction.SystemException Description copied from interface:javax.transaction.Transaction
Register a synchronization object for the transaction currently associated with the target object. The transction manager invokes the beforeCompletion method prior to starting the two-phase transaction commit process. After the transaction is completed, the transaction manager invokes the afterCompletion method.- Specified by:
registerSynchronization
in interfacejavax.transaction.Transaction
- Parameters:
synch
- The Synchronization object for the transaction associated with the target object.- Throws:
IllegalStateException
- Thrown if the transaction in the target object is in the prepared state or the transaction is inactive.javax.transaction.RollbackException
- Thrown to indicate that the transaction has been marked for rollback only.javax.transaction.SystemException
- Thrown if the transaction manager encounters an unexpected error condition.
-
enlistResource
public boolean enlistResource(XAResource xaRes) throws IllegalStateException, javax.transaction.RollbackException, javax.transaction.SystemException Description copied from interface:javax.transaction.Transaction
Enlist the resource specified with the transaction associated with the target Transaction object.- Specified by:
enlistResource
in interfacejavax.transaction.Transaction
- Parameters:
xaRes
- The XAResource object associated with the resource (connection).- Returns:
- true if the resource was enlisted successfully; otherwise false.
- Throws:
IllegalStateException
- Thrown if the transaction in the target object is in the prepared state or the transaction is inactive.javax.transaction.RollbackException
- Thrown to indicate that the transaction has been marked for rollback only.javax.transaction.SystemException
- Thrown if the transaction manager encounters an unexpected error condition.
-
delistResource
public boolean delistResource(XAResource xaRes, int flag) throws IllegalStateException, javax.transaction.SystemException Description copied from interface:javax.transaction.Transaction
Disassociate the resource specified from the transaction associated with the target Transaction object.- Specified by:
delistResource
in interfacejavax.transaction.Transaction
- Parameters:
xaRes
- The XAResource object associated with the resource (connection).flag
- One of the values of TMSUCCESS, TMSUSPEND, or TMFAIL.- Returns:
- true if the resource was delisted successfully; otherwise false.
- Throws:
IllegalStateException
- Thrown if the transaction in the target object is inactive.javax.transaction.SystemException
- Thrown if the transaction manager encounters an unexpected error condition.
-
commit
public void commit() throws javax.transaction.HeuristicMixedException, javax.transaction.HeuristicRollbackException, javax.transaction.RollbackException, SecurityException, javax.transaction.SystemExceptionDescription copied from interface:javax.transaction.Transaction
Complete the transaction represented by this Transaction object.- Specified by:
commit
in interfacejavax.transaction.Transaction
- Throws:
javax.transaction.HeuristicMixedException
- Thrown to indicate that a heuristic decision was made and that some relevant updates have been committed while others have been rolled back.javax.transaction.HeuristicRollbackException
- Thrown to indicate that a heuristic decision was made and that all relevant updates have been rolled back.javax.transaction.RollbackException
- Thrown to indicate that the transaction has been rolled back rather than committed.SecurityException
- Thrown to indicate that the thread is not allowed to commit the transaction.javax.transaction.SystemException
- Thrown if the transaction manager encounters an unexpected error condition.
-
rollback
Description copied from interface:javax.transaction.Transaction
Rollback the transaction represented by this Transaction object.- Specified by:
rollback
in interfacejavax.transaction.Transaction
- Throws:
IllegalStateException
- Thrown if the transaction in the target object is in the prepared state or the transaction is inactive.javax.transaction.SystemException
- Thrown if the transaction manager encounters an unexpected error condition.
-
equals
-
addBranchXid
public org.apache.geronimo.transaction.manager.TransactionImpl.TransactionBranch addBranchXid(XAResource xaRes, Xid branchId)
-