public interface SleeTransactionManager
SleeTransactionManager
interface extends the JTA
TransactionManager
interface by providing asynchronous commit and rollback
operations.Modifier and Type | Method and Description |
---|---|
SleeTransaction |
asSleeTransaction(Transaction tx)
Get a
SleeTransaction object for a generic Transaction
object. |
void |
asyncCommit(CommitListener listener)
Request that the transaction associated with the current thread asynchronously commit.
|
void |
asyncRollback(RollbackListener listener)
Request that the transaction associated with the current thread asynchronously roll back.
|
SleeTransaction |
beginSleeTransaction()
Begin a new transaction and associate it with the current thread.
|
SleeTransaction |
getSleeTransaction()
Get the
SleeTransaction object that represents the transaction context of the
calling thread. |
SleeTransaction beginSleeTransaction() throws NotSupportedException, SystemException
SleeTransactionManager txManager = ...;
txManager.begin();
SleeTransaction tx = txManager.getSleeTransaction();
This method is a non-transactional method, however after this method returns a new transaction has become associated with the calling thread.
SleeTransaction
object representing the new transaction.NotSupportedException
- if the thread is already associated with a transaction
and the transaction manager implementation does not support nested transactions.SystemException
- if the transaction could not be started due to a system-level
failure.SleeTransaction getSleeTransaction() throws SystemException
SleeTransaction
object that represents the transaction context of the
calling thread. This method is a convenience method equivalent to:
SleeTransactionManager txManager = ...;
SleeTransaction tx = txManager.asSleeTransaction(txManager.getTransaction());
This method is a non-transactional method.
SleeTransaction
object that represents the transaction context
of the calling thread, or null
if the thread is not currently
associated with a transaction.SystemException
- if the transaction object could not be obtained due to a
system-level failure.SleeTransaction asSleeTransaction(Transaction tx) throws NullPointerException, IllegalArgumentException, SystemException
SleeTransaction
object for a generic Transaction
object.tx
- the Transaction
object. The transaction represented by this
object must have been started by this transaction manager.SleeTransaction
object for the specified transaction.NullPointerException
- if tx
is null
.IllegalArgumentException
- if tx
represents a transaction that was
not started by this transaction manager.SystemException
- if the transaction object could not be obtained due to a
system-level failure.void asyncCommit(CommitListener listener) throws IllegalStateException, SecurityException
If the transaction has been marked for rollback, or if execution of any
Synchronization
callbacks cause it to
be marked for rollback, then a rollback will be started (equivalent to calling
asyncRollback(javax.slee.transaction.RollbackListener)
).
At some point after calling this method, the transaction state will become either
Status.STATUS_COMMITTED
or
Status.STATUS_ROLLEDBACK
.
This method is a mandatory transactional method.
listener
- listener object that will receive callbacks depending on the final
outcome of the transaction. If this argument is null
, no callbacks
will be made by the SLEE.IllegalStateException
- if a transaction is not currently associated with the
calling thread.SecurityException
- if the current thread is not allowed to commit the transaction.void asyncRollback(RollbackListener listener) throws IllegalStateException, SecurityException
At some point after calling this method, the transaction state will become
Status.STATUS_ROLLEDBACK
.
This method is a mandatory transactional method.
listener
- listener object that will receive callbacks depending on the final
outcome of the transaction. If this argument is null
, no callbacks
will be made by the SLEE.IllegalStateException
- if a transaction is not currently associated with the
calling thread.SecurityException
- if the current thread is not allowed to roll back the transaction.