Class TransactionImpl
- java.lang.Object
-
- org.apache.geronimo.transaction.manager.TransactionImpl
-
- All Implemented Interfaces:
Transaction
public class TransactionImpl extends Object implements Transaction
Basic local transaction with support for multiple resources.
-
-
Constructor Summary
Constructors Constructor Description TransactionImpl(Xid xid, TransactionManagerImpl txManager)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.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
equals(Object obj)
Object
getResource(Object key)
boolean
getRollbackOnly()
int
getStatus()
Obtain the status of the transaction associated with the target Transaction object.Object
getTransactionKey()
int
getTransactionStatus()
void
putResource(Object key, Object value)
void
registerInterposedSynchronization(Synchronization synchronization)
void
registerSynchronization(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
setRollbackOnly()
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 Detail
-
TransactionImpl
public TransactionImpl(Xid xid, TransactionManagerImpl txManager)
-
-
Method Detail
-
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 interfaceTransaction
- Returns:
- The transaction status. If no transaction is associated with the target object, this method returns the Status.NoTransaction value.
-
getRollbackOnly
public boolean getRollbackOnly()
-
getTransactionKey
public Object getTransactionKey()
-
getTransactionStatus
public int getTransactionStatus()
-
registerInterposedSynchronization
public void registerInterposedSynchronization(Synchronization synchronization)
-
setRollbackOnly
public void setRollbackOnly() throws IllegalStateException
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 interfaceTransaction
- Throws:
IllegalStateException
- Thrown if the target object is not associated with any transaction.
-
setRollbackOnly
public void setRollbackOnly(Throwable reason)
-
registerSynchronization
public void registerSynchronization(Synchronization synch) throws IllegalStateException, RollbackException, 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 interfaceTransaction
- 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.RollbackException
- Thrown to indicate that the transaction has been marked for rollback only.SystemException
- Thrown if the transaction manager encounters an unexpected error condition.
-
enlistResource
public boolean enlistResource(XAResource xaRes) throws IllegalStateException, RollbackException, 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 interfaceTransaction
- 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.RollbackException
- Thrown to indicate that the transaction has been marked for rollback only.SystemException
- Thrown if the transaction manager encounters an unexpected error condition.
-
delistResource
public boolean delistResource(XAResource xaRes, int flag) throws IllegalStateException, 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 interfaceTransaction
- 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.SystemException
- Thrown if the transaction manager encounters an unexpected error condition.
-
commit
public void commit() throws HeuristicMixedException, HeuristicRollbackException, RollbackException, SecurityException, SystemException
Description copied from interface:javax.transaction.Transaction
Complete the transaction represented by this Transaction object.- Specified by:
commit
in interfaceTransaction
- Throws:
HeuristicMixedException
- Thrown to indicate that a heuristic decision was made and that some relevant updates have been committed while others have been rolled back.HeuristicRollbackException
- Thrown to indicate that a heuristic decision was made and that all relevant updates have been rolled back.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.SystemException
- Thrown if the transaction manager encounters an unexpected error condition.
-
rollback
public void rollback() throws IllegalStateException, SystemException
Description copied from interface:javax.transaction.Transaction
Rollback the transaction represented by this Transaction object.- Specified by:
rollback
in interfaceTransaction
- Throws:
IllegalStateException
- Thrown if the transaction in the target object is in the prepared state or the transaction is inactive.SystemException
- Thrown if the transaction manager encounters an unexpected error condition.
-
addBranchXid
public org.apache.geronimo.transaction.manager.TransactionImpl.TransactionBranch addBranchXid(XAResource xaRes, Xid branchId)
-
-