Package cloud.piranha.transaction.nonxa
Class DefaultTransaction
java.lang.Object
cloud.piranha.transaction.nonxa.DefaultTransaction
- All Implemented Interfaces:
Transaction
The default Transaction.
- Author:
- Manfred Riem ([email protected])
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
commit()
Commit the transaction.boolean
delistResource(XAResource xaResource, int flags)
Delist the resource.boolean
enlistResource(XAResource xaResource)
Enlist the resource.int
Returns the status.void
registerSynchronization(Synchronization synchronization)
Register a synchronization.void
rollback()
Rollback the transaction.void
Set rollback only.void
setTimeout(int timeout)
Set the timeout.void
setTransactionManager(TransactionManager transactionManager)
Set the transaction manager.
-
Constructor Details
-
DefaultTransaction
public DefaultTransaction()Constructor.
-
-
Method Details
-
commit
public void commit() throws RollbackException, HeuristicMixedException, HeuristicRollbackException, SecurityException, IllegalStateException, SystemExceptionCommit the transaction.- Specified by:
commit
in interfaceTransaction
- Throws:
RollbackException
- when a rollback error occurs.HeuristicMixedException
- when the heuristics were mixed.HeuristicRollbackException
- when a rollback error occurs.SecurityException
- when a security error occurs.IllegalStateException
- when the transaction is not active.SystemException
- when a serious error occurs.
-
delistResource
public boolean delistResource(XAResource xaResource, int flags) throws IllegalStateException, SystemExceptionDelist the resource.- Specified by:
delistResource
in interfaceTransaction
- Parameters:
xaResource
- the XA resource.flags
- the flags.- Returns:
- true when delisted, false otherwise.
- Throws:
IllegalStateException
- when the transaction is not active.SystemException
- when a serious error occurs.
-
enlistResource
public boolean enlistResource(XAResource xaResource) throws RollbackException, IllegalStateException, SystemExceptionEnlist the resource.- Specified by:
enlistResource
in interfaceTransaction
- Parameters:
xaResource
- the XA resource.- Returns:
- true if enlisted, false otherwise.
- Throws:
RollbackException
- when transaction has already been marked for rollback.IllegalStateException
- when the transaction is not active.SystemException
- when a serious error occurs.
-
getStatus
Returns the status.- Specified by:
getStatus
in interfaceTransaction
- Returns:
- the status
- Throws:
SystemException
- when a serious error occurs.
-
registerSynchronization
public void registerSynchronization(Synchronization synchronization) throws RollbackException, IllegalStateException, SystemExceptionRegister a synchronization.- Specified by:
registerSynchronization
in interfaceTransaction
- Parameters:
synchronization
- the synchronization.- Throws:
RollbackException
- when a rollback error occurs.IllegalStateException
- when the transaction is not activeSystemException
- when a serious error occurs.
-
rollback
Rollback the transaction.- Specified by:
rollback
in interfaceTransaction
- Throws:
IllegalStateException
- when the transaction is not active.SystemException
- when a serious error occurs.
-
setRollbackOnly
Set rollback only.- Specified by:
setRollbackOnly
in interfaceTransaction
- Throws:
IllegalStateException
- when the transaction is not active.SystemException
- when a serious error occurs.
-
setTimeout
public void setTimeout(int timeout)Set the timeout.- Parameters:
timeout
- the timeout.
-
setTransactionManager
Set the transaction manager.- Parameters:
transactionManager
- the transaction manager.
-