Package cloud.piranha.transaction.nonxa
Class DefaultTransactionManager
- java.lang.Object
-
- cloud.piranha.transaction.nonxa.DefaultTransactionManager
-
- All Implemented Interfaces:
TransactionManager
public class DefaultTransactionManager extends Object implements TransactionManager
The default TransactionManager.- Author:
- Manfred Riem ([email protected])
-
-
Constructor Summary
Constructors Constructor Description DefaultTransactionManager()
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods 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.
-
-
-
Method Detail
-
begin
public void begin() throws NotSupportedException, SystemException
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, SecurityException, IllegalStateException, SystemException
Commit 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.SecurityException
- when a security error occurs.IllegalStateException
- when the transaction is not active.SystemException
- when a serious error occurs.
-
getStatus
public int getStatus() throws SystemException
Get the status.- Specified by:
getStatus
in interfaceTransactionManager
- Returns:
- the status.
- Throws:
SystemException
- when a serious error occurs.
-
getTransaction
public Transaction getTransaction() throws SystemException
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, IllegalStateException, SystemException
Resume the transaction.- Specified by:
resume
in interfaceTransactionManager
- Parameters:
transaction
- the transaction.- Throws:
InvalidTransactionException
- when the transaction could not be found.IllegalStateException
- when the transaction is not active.SystemException
- when a serious error occurs.
-
rollback
public void rollback() throws IllegalStateException, SecurityException, SystemException
Rollback the transaction.- Specified by:
rollback
in interfaceTransactionManager
- Throws:
IllegalStateException
- when the transaction is not active.SecurityException
- when a security error occurs.SystemException
- when a serious error occurs.
-
setRollbackOnly
public void setRollbackOnly() throws IllegalStateException, SystemException
Set the rollback only.- Specified by:
setRollbackOnly
in interfaceTransactionManager
- Throws:
IllegalStateException
- when the transaction is not active.SystemException
- when a serious error occurs.
-
setTransactionTimeout
public void setTransactionTimeout(int timeout) throws SystemException
Set the transaction timeout.- Specified by:
setTransactionTimeout
in interfaceTransactionManager
- Parameters:
timeout
- the timeout.- Throws:
SystemException
- when a serious error occurs.
-
suspend
public Transaction suspend() throws SystemException
Suspend the transaction.- Specified by:
suspend
in interfaceTransactionManager
- Returns:
- the transaction.
- Throws:
SystemException
- when a serious error occurs.
-
-