Package cloud.piranha.transaction.nonxa
Class DefaultTransactionManager
java.lang.Object
cloud.piranha.transaction.nonxa.DefaultTransactionManager
- All Implemented Interfaces:
TransactionManager
public class DefaultTransactionManager extends java.lang.Object implements TransactionManager
The default TransactionManager.
- Author:
- Manfred Riem ([email protected])
-
Constructor Summary
Constructors Constructor Description DefaultTransactionManager()
Constructor. -
Method Summary
Modifier and Type Method Description void
begin()
Begin a transaction.void
commit()
Commit a transaction.int
getStatus()
Get the status.Transaction
getTransaction()
Get the transaction.void
resume(Transaction transaction)
Resume the transaction.void
rollback()
Rollback the transaction.void
setRollbackOnly()
Set the rollback only.void
setTransactionTimeout(int timeout)
Set the transaction timeout.Transaction
suspend()
Suspend the transaction.
-
Constructor Details
-
DefaultTransactionManager
public DefaultTransactionManager()Constructor.
-
-
Method Details
-
begin
Begin a transaction.- Specified by:
begin
in interfaceTransactionManager
- Throws:
NotSupportedException
- when a nested transaction is attempted.SystemException
- when a serious error occurs.
-
commit
public void commit() throws RollbackException, HeuristicMixedException, HeuristicRollbackException, java.lang.SecurityException, java.lang.IllegalStateException, SystemExceptionCommit a transaction.- Specified by:
commit
in interfaceTransactionManager
- Throws:
RollbackException
- when a rollback error occurs.HeuristicMixedException
- when heuristics are being 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.
-
getStatus
Get the status.- Specified by:
getStatus
in interfaceTransactionManager
- Returns:
- the status.
- Throws:
SystemException
- when a serious error occurs.
-
getTransaction
Get the transaction.- Specified by:
getTransaction
in interfaceTransactionManager
- Returns:
- the transaction, or null if not found.
- Throws:
SystemException
- when a serious error occurs.
-
resume
public void resume(Transaction transaction) throws InvalidTransactionException, java.lang.IllegalStateException, SystemExceptionResume the transaction.- Specified by:
resume
in interfaceTransactionManager
- Parameters:
transaction
- the transaction.- Throws:
InvalidTransactionException
- when the transaction could not be found.java.lang.IllegalStateException
- when the transaction is not active.SystemException
- when a serious error occurs.
-
rollback
public void rollback() throws java.lang.IllegalStateException, java.lang.SecurityException, SystemExceptionRollback the transaction.- Specified by:
rollback
in interfaceTransactionManager
- Throws:
java.lang.IllegalStateException
- when the transaction is not active.java.lang.SecurityException
- when a security error occurs.SystemException
- when a serious error occurs.
-
setRollbackOnly
Set the rollback only.- Specified by:
setRollbackOnly
in interfaceTransactionManager
- Throws:
java.lang.IllegalStateException
- when the transaction is not active.SystemException
- when a serious error occurs.
-
setTransactionTimeout
Set the transaction timeout.- Specified by:
setTransactionTimeout
in interfaceTransactionManager
- Parameters:
timeout
- the timeout.- Throws:
SystemException
- when a serious error occurs.
-
suspend
Suspend the transaction.- Specified by:
suspend
in interfaceTransactionManager
- Returns:
- the transaction.
- Throws:
SystemException
- when a serious error occurs.
-