Package com.arjuna.ats.jbossatx
Class BaseTransactionManagerDelegate
- java.lang.Object
-
- com.arjuna.ats.jbossatx.BaseTransactionManagerDelegate
-
- All Implemented Interfaces:
TransactionManager,org.jboss.tm.listener.TransactionListenerRegistry,org.jboss.tm.TransactionLocalDelegate,org.jboss.tm.TransactionTimeoutConfiguration
- Direct Known Subclasses:
TransactionManagerDelegate,TransactionManagerDelegate
public abstract class BaseTransactionManagerDelegate extends Object implements TransactionManager, org.jboss.tm.TransactionLocalDelegate, org.jboss.tm.TransactionTimeoutConfiguration, org.jboss.tm.listener.TransactionListenerRegistry
Delegate for JBoss TransactionManager/TransactionLocalDelegate.- Author:
- kevin
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedBaseTransactionManagerDelegate(TransactionManager transactionManager)Construct the delegate using the specified transaction manager.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddListener(Transaction transaction, org.jboss.tm.listener.TransactionListener listener, EnumSet<org.jboss.tm.listener.EventType> types)register a listener for transaction related events that effect the current threadvoidbegin()Begin a transaction and associate it with the current thread.voidcommit()Commit the current transaction and disassociate from the thread.booleancontainsValue(org.jboss.tm.TransactionLocal transactionLocal, Transaction transaction)Does the specified transaction contain a value for the transaction local.intgetStatus()Get the transaction status.TransactiongetTransaction()Get the transaction associated with the thread.ObjectgetValue(org.jboss.tm.TransactionLocal transactionLocal, Transaction transaction)Get value of the transaction local in the specified transaction.voidlock(org.jboss.tm.TransactionLocal local, Transaction transaction)Lock the transaction local in the context of this transaction.voidresume(Transaction transaction)Resume the specified transaction.voidrollback()Rollback the current transaction and disassociate from the thread.voidsetRollbackOnly()Set rollback only on the current transaction.voidsetTransactionTimeout(int timeout)Set the transaction timeout on the current thread.voidstoreValue(org.jboss.tm.TransactionLocal transactionLocal, Transaction transaction, Object value)Store the value of the transaction local in the specified transaction.Transactionsuspend()Suspend the current transaction.voidunlock(org.jboss.tm.TransactionLocal local, Transaction transaction)Unlock the transaction local in the context of this transaction
-
-
-
Constructor Detail
-
BaseTransactionManagerDelegate
protected BaseTransactionManagerDelegate(TransactionManager transactionManager)
Construct the delegate using the specified transaction manager.- Parameters:
transactionManager- The delegate transaction manager.
-
-
Method Detail
-
begin
public void begin() throws NotSupportedException, SystemExceptionBegin a transaction and associate it with the current thread.- Specified by:
beginin interfaceTransactionManager- Throws:
NotSupportedExceptionSystemException
-
commit
public void commit() throws RollbackException, HeuristicMixedException, HeuristicRollbackException, SecurityException, IllegalStateException, SystemExceptionCommit the current transaction and disassociate from the thread.- Specified by:
commitin interfaceTransactionManager- Throws:
RollbackExceptionHeuristicMixedExceptionHeuristicRollbackExceptionSecurityExceptionIllegalStateExceptionSystemException
-
getStatus
public int getStatus() throws SystemExceptionGet the transaction status.- Specified by:
getStatusin interfaceTransactionManager- Returns:
- the transaction status.
- Throws:
SystemException
-
getTransaction
public Transaction getTransaction() throws SystemException
Get the transaction associated with the thread.- Specified by:
getTransactionin interfaceTransactionManager- Returns:
- the transaction or null if none associated.
- Throws:
SystemException
-
resume
public void resume(Transaction transaction) throws InvalidTransactionException, IllegalStateException, SystemException
Resume the specified transaction.- Specified by:
resumein interfaceTransactionManager- Parameters:
transaction- The transaction to resume.- Throws:
InvalidTransactionExceptionIllegalStateExceptionSystemException
-
rollback
public void rollback() throws IllegalStateException, SecurityException, SystemExceptionRollback the current transaction and disassociate from the thread.- Specified by:
rollbackin interfaceTransactionManager- Throws:
IllegalStateExceptionSecurityExceptionSystemException
-
setRollbackOnly
public void setRollbackOnly() throws IllegalStateException, SystemExceptionSet rollback only on the current transaction.- Specified by:
setRollbackOnlyin interfaceTransactionManager- Throws:
IllegalStateExceptionSystemException
-
setTransactionTimeout
public void setTransactionTimeout(int timeout) throws SystemExceptionSet the transaction timeout on the current thread.- Specified by:
setTransactionTimeoutin interfaceTransactionManager- Parameters:
timeout- The transaction timeout.- Throws:
SystemException
-
addListener
public void addListener(Transaction transaction, org.jboss.tm.listener.TransactionListener listener, EnumSet<org.jboss.tm.listener.EventType> types) throws org.jboss.tm.listener.TransactionTypeNotSupported
register a listener for transaction related events that effect the current thread- Specified by:
addListenerin interfaceorg.jboss.tm.listener.TransactionListenerRegistry- Parameters:
listener- the callback for event notifications- Throws:
org.jboss.tm.listener.TransactionTypeNotSupported
-
suspend
public Transaction suspend() throws SystemException
Suspend the current transaction.- Specified by:
suspendin interfaceTransactionManager- Returns:
- The suspended transaction.
- Throws:
SystemException
-
containsValue
public boolean containsValue(org.jboss.tm.TransactionLocal transactionLocal, Transaction transaction)Does the specified transaction contain a value for the transaction local.- Specified by:
containsValuein interfaceorg.jboss.tm.TransactionLocalDelegate- Parameters:
transactionLocal- The associated transaction local.transaction- The associated transaction.- Returns:
- true if a value exists within the specified transaction, false otherwise.
-
getValue
public Object getValue(org.jboss.tm.TransactionLocal transactionLocal, Transaction transaction)
Get value of the transaction local in the specified transaction.- Specified by:
getValuein interfaceorg.jboss.tm.TransactionLocalDelegate- Parameters:
transactionLocal- The associated transaction local.transaction- The associated transaction.- Returns:
- The value of the transaction local.
-
storeValue
public void storeValue(org.jboss.tm.TransactionLocal transactionLocal, Transaction transaction, Object value)Store the value of the transaction local in the specified transaction.- Specified by:
storeValuein interfaceorg.jboss.tm.TransactionLocalDelegate- Parameters:
transactionLocal- The associated transaction local.transaction- The associated transaction.value- The value of the transaction local.
-
lock
public void lock(org.jboss.tm.TransactionLocal local, Transaction transaction) throws InterruptedExceptionLock the transaction local in the context of this transaction.- Specified by:
lockin interfaceorg.jboss.tm.TransactionLocalDelegate- Throws:
IllegalStateException- if the transaction is not activeInterruptedException- if the thread is interrupted
-
unlock
public void unlock(org.jboss.tm.TransactionLocal local, Transaction transaction)Unlock the transaction local in the context of this transaction- Specified by:
unlockin interfaceorg.jboss.tm.TransactionLocalDelegate
-
-