Class JTAUserTransactionAdapter
- java.lang.Object
-
- org.apache.batchee.container.services.transaction.JTAUserTransactionAdapter
-
- All Implemented Interfaces:
TransactionManagerAdapter
public class JTAUserTransactionAdapter extends Object implements TransactionManagerAdapter
-
-
Field Summary
Fields Modifier and Type Field Description protected TransactionManagermgr
-
Constructor Summary
Constructors Constructor Description JTAUserTransactionAdapter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbegin()Create a new transaction and associate it with the current thread.TransactionbeginSuspending()voidcommit()Complete the transaction associated with the current thread.intgetStatus()Obtain the status of the transaction associated with the current thread.voidresume(Transaction transaction)voidrollback()Roll back the transaction associated with the current thread.voidsetRollbackOnly()Modify the transaction associated with the current thread such that the only possible outcome of the transaction is to roll back the transaction.voidsetTransactionTimeout(int seconds)Modify the value of the timeout value that is associated with the transactions started by the current thread with the begin method.
-
-
-
Field Detail
-
mgr
protected TransactionManager mgr
-
-
Method Detail
-
begin
public void begin() throws TransactionManagementExceptionDescription copied from interface:TransactionManagerAdapterCreate a new transaction and associate it with the current thread.- Specified by:
beginin interfaceTransactionManagerAdapter- Throws:
TransactionManagementException
-
beginSuspending
public Transaction beginSuspending() throws TransactionManagementException
- Throws:
TransactionManagementException
-
resume
public void resume(Transaction transaction)
-
commit
public void commit() throws TransactionManagementExceptionDescription copied from interface:TransactionManagerAdapterComplete the transaction associated with the current thread.- Specified by:
commitin interfaceTransactionManagerAdapter- Throws:
TransactionManagementException
-
rollback
public void rollback() throws TransactionManagementExceptionDescription copied from interface:TransactionManagerAdapterRoll back the transaction associated with the current thread. When this method completes, the thread becomes associated with no transaction. Attention: this must not throw an Exception until there is a setup problem! So if the tx is not active anymore and we get an Exception while trying to rollback then it MUST get catched away. Otoh if there is a setup or system issue the Exception from the rollback needs to get thrown.- Specified by:
rollbackin interfaceTransactionManagerAdapter- Throws:
TransactionManagementException
-
getStatus
public int getStatus() throws TransactionManagementExceptionDescription copied from interface:TransactionManagerAdapterObtain the status of the transaction associated with the current thread.- Specified by:
getStatusin interfaceTransactionManagerAdapter- Returns:
- The transaction status.
- Throws:
TransactionManagementException
-
setRollbackOnly
public void setRollbackOnly() throws TransactionManagementExceptionDescription copied from interface:TransactionManagerAdapterModify the transaction associated with the current thread such that the only possible outcome of the transaction is to roll back the transaction.- Specified by:
setRollbackOnlyin interfaceTransactionManagerAdapter- Throws:
TransactionManagementException
-
setTransactionTimeout
public void setTransactionTimeout(int seconds) throws TransactionManagementExceptionDescription copied from interface:TransactionManagerAdapterModify the value of the timeout value that is associated with the transactions started by the current thread with the begin method.- Specified by:
setTransactionTimeoutin interfaceTransactionManagerAdapter- Parameters:
seconds- seconds - The value of the timeout in seconds. If the value is zero, the transaction service restores the default value.- Throws:
TransactionManagementException
-
-