TransactionManager
interface allows the application server to control transaction boundaries on behalf of the application being managed.
TransactionManager
, invoke the static method com.arjuna.ats.jta.TransactionManager.transactionManager
.
TransactionManager
maintains the transaction context association with threads as part of its internal data structure. A thread’s transaction context may be null
or it may refer to a specific global transaction. Multiple threads may be associated with the same global transaction. As noted in Section 2.3, “UserTransaction” , nested transactions are not supported.
TransactionManager
Methods
begin
|
Starts a new top-level transaction and associates the transaction context with the calling thread. If the calling thread is already associated with a transaction, exception
NotSupportedException is thrown.
|
getTransaction
|
Returns the Transaction object representing the transaction context which is currently associated with the calling thread. You can use this object to perform various operations on the target transaction.
|
commit
|
Completes the transaction currently associated with the calling thread. After it returns, the calling thread is associated with no transaction. If
commit is called when the thread is not associated with any transaction context, an exception is thrown. In some implementations, the commit operation is restricted to the transaction originator only. If the calling thread is not allowed to commit the transaction, an exception is thrown. JBoss Transactions does not currently impose any restriction on the ability of threads to terminate transactions.
|
rollback
|
Rolls back the transaction associated with the current thread. After the
rollback method completes, the thread is associated with no transaction.
|
commit
or rollback
by throwing exception IllegalStateException
.