Package cloud.piranha.transaction.nonxa
Class DefaultTransaction
java.lang.Object
cloud.piranha.transaction.nonxa.DefaultTransaction
- All Implemented Interfaces:
Transaction
public class DefaultTransaction extends java.lang.Object implements Transaction
The default Transaction.
- Author:
- Manfred Riem ([email protected])
-
Constructor Summary
Constructors Constructor Description DefaultTransaction()
Constructor. -
Method Summary
Modifier and Type Method Description void
commit()
Commit the transaction.boolean
delistResource(javax.transaction.xa.XAResource xaResource, int flags)
Delist the resource.boolean
enlistResource(javax.transaction.xa.XAResource xaResource)
Enlist the resource.int
getStatus()
Get the status.void
registerSynchronization(Synchronization synchronization)
Register a synchronization.void
rollback()
Rollback the transaction.void
setRollbackOnly()
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, java.lang.SecurityException, java.lang.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.java.lang.SecurityException
- when a security error occurs.java.lang.IllegalStateException
- when the transaction is not active.SystemException
- when a serious error occurs.
-
delistResource
public boolean delistResource(javax.transaction.xa.XAResource xaResource, int flags) throws java.lang.IllegalStateException, SystemExceptionDelist the resource.- Specified by:
delistResource
in interfaceTransaction
- Parameters:
xaResource
- the XA resource.flags
- the flags.- Returns:
- true when delisted, false otherwise.
- Throws:
java.lang.IllegalStateException
- when the transaction is not active.SystemException
- when a serious error occurs.
-
enlistResource
public boolean enlistResource(javax.transaction.xa.XAResource xaResource) throws RollbackException, java.lang.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.java.lang.IllegalStateException
- when the transaction is not active.SystemException
- when a serious error occurs.
-
getStatus
Get 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, java.lang.IllegalStateException, SystemExceptionRegister a synchronization.- Specified by:
registerSynchronization
in interfaceTransaction
- Parameters:
synchronization
- the synchronization.- Throws:
RollbackException
- when a rollback error occurs.java.lang.IllegalStateException
- when the transaction is not activeSystemException
- when a serious error occurs.
-
rollback
Rollback the transaction.- Specified by:
rollback
in interfaceTransaction
- Throws:
java.lang.IllegalStateException
- when the transaction is not active.SystemException
- when a serious error occurs.
-
setRollbackOnly
Set rollback only.- Specified by:
setRollbackOnly
in interfaceTransaction
- Throws:
java.lang.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.
-