| javax.transaction.Transaction
Transaction | public interface Transaction (Code) | | The Transaction interface allows operations to be performed against
the transaction in the target Transaction object. A Transaction
object is created corresponding to each global transaction creation.
The Transaction object can be used for resource enlistment,
synchronization registration, transaction completion, and status
query operations.
|
Method Summary | |
public void | commit() Complete the transaction represented by this Transaction object. | public boolean | delistResource(XAResource xaRes, int flag) Disassociate the resource specified from the transaction associated
with the target Transaction object.
Parameters: xaRes - The XAResource object associated with the resource (connection). Parameters: flag - One of the values of TMSUCCESS, TMSUSPEND, or TMFAIL. exception: IllegalStateException - Thrown if the transaction in thetarget object is inactive. exception: SystemException - Thrown if the transaction managerencounters an unexpected error condition. | public boolean | enlistResource(XAResource xaRes) Enlist the resource specified with the transaction associated with the
target Transaction object.
Parameters: xaRes - The XAResource object associated with the resource (connection). | public int | getStatus() Obtain the status of the transaction associated with the target
Transaction object.
The transaction status. | public void | registerSynchronization(Synchronization sync) Register a synchronization object for the transaction currently
associated with the target object. | public void | rollback() Rollback the transaction represented by this Transaction object. | public 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. |
delistResource | public boolean delistResource(XAResource xaRes, int flag) throws IllegalStateException, SystemException(Code) | | Disassociate the resource specified from the transaction associated
with the target Transaction object.
Parameters: xaRes - The XAResource object associated with the resource (connection). Parameters: flag - One of the values of TMSUCCESS, TMSUSPEND, or TMFAIL. exception: IllegalStateException - Thrown if the transaction in thetarget object is inactive. exception: SystemException - Thrown if the transaction managerencounters an unexpected error condition. true if the resource was delisted successfully; otherwisefalse. |
enlistResource | public boolean enlistResource(XAResource xaRes) throws RollbackException, IllegalStateException, SystemException(Code) | | Enlist the resource specified with the transaction associated with the
target Transaction object.
Parameters: xaRes - The XAResource object associated with the resource (connection). true if the resource was enlisted successfully; otherwisefalse. exception: RollbackException - Thrown to indicate thatthe transaction has been marked for rollback only. exception: IllegalStateException - Thrown if the transaction in thetarget object is in the prepared state or the transaction isinactive. exception: SystemException - Thrown if the transaction managerencounters an unexpected error condition. |
getStatus | public int getStatus() throws SystemException(Code) | | Obtain the status of the transaction associated with the target
Transaction object.
The transaction status. If no transaction is associated withthe target object, this method returns the Status.NoTransaction value. exception: SystemException - Thrown if the transaction managerencounters an unexpected error condition. |
registerSynchronization | public void registerSynchronization(Synchronization sync) throws RollbackException, IllegalStateException, SystemException(Code) | | 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.
Parameters: sync - The Synchronization object for the transaction associatedwith the target object. exception: RollbackException - Thrown to indicate thatthe transaction has been marked for rollback only. exception: IllegalStateException - Thrown if the transaction in thetarget object is in the prepared state or the transaction isinactive. exception: SystemException - Thrown if the transaction managerencounters an unexpected error condition. |
setRollbackOnly | public void setRollbackOnly() throws IllegalStateException, SystemException(Code) | | Modify the transaction associated with the target object such that
the only possible outcome of the transaction is to roll back the
transaction.
exception: IllegalStateException - Thrown if the target object isnot associated with any transaction. exception: SystemException - Thrown if the transaction managerencounters an unexpected error condition. |
|
|