public abstract class DelegatingTransactionManager extends Object implements TransactionManager
abstract TransactionManager implementation that
delegates all method invocations to another TransactionManager.
This class is public for convenience. It is extended by
other non-public internal classes.
TransactionManager| Modifier | Constructor and Description |
|---|---|
protected |
DelegatingTransactionManager(TransactionManager delegate)
Creates a new
DelegatingTransactionManager. |
| Modifier and Type | Method and Description |
|---|---|
void |
begin()
Creates a new transaction and associates it with the current
thread.
|
void |
commit()
Completes the transaction associated with the current thread.
|
int |
getStatus()
Returns the status of the transaction associated with the
current thread.
|
Transaction |
getTransaction()
Returns the
Transaction object that represents the
transaction context of the calling thread. |
void |
resume(Transaction transaction)
Resumes the transaction context association of the calling
thread with the transaction represented by the supplied
Transaction object. |
void |
rollback()
Rolls back the transaction associated with the current thread.
|
void |
setRollbackOnly()
Irrevocably modifies the transaction associated with the
current thread such that the only possible outcome is for it to
roll back.
|
void |
setTransactionTimeout(int seconds)
Sets the timeout value that is associated with transactions
started by the current thread with the
begin() method. |
Transaction |
suspend()
Suspends the transaction currently associated with the calling
thread and returns a
Transaction that represents the
transaction context being suspended, or null if the
calling thread is not associated with a transaction. |
protected DelegatingTransactionManager(TransactionManager delegate)
DelegatingTransactionManager.delegate - the TransactionManager to which all
method invocations will be delegated; may be null, but
then a SystemException will be thrown by every method
in this class when invokedpublic void begin()
throws NotSupportedException,
SystemException
begin in interface TransactionManagerNotSupportedException - if the thread is already
associated with a transaction and this TransactionManager implementation does not support nested
transactionsSystemException - if this TransactionManager
encounters an unexpected error conditionpublic void commit()
throws RollbackException,
HeuristicMixedException,
HeuristicRollbackException,
SystemException
When this method completes, the thread is no longer associated with a transaction.
commit in interface TransactionManagerRollbackException - if the transaction has been rolled
back rather than committedHeuristicMixedException - if a heuristic decision was
made and that some relevant updates have been committed while
others have been rolled backHeuristicRollbackException - if a heuristic decision
was made and all relevant updates have been rolled backSecurityException - if the thread is not allowed to
commit the transactionIllegalStateException - if the current thread is not
associated with a transactionSystemException - if this TransactionManager
encounters an unexpected error conditionpublic int getStatus()
throws SystemException
getStatus in interface TransactionManagerint constants in the Status class; if no
transaction is associated with the current thread, this method
returns Status.STATUS_NO_TRANSACTIONSystemException - if this TransactionManager
encounters an unexpected error conditionStatuspublic Transaction getTransaction() throws SystemException
Transaction object that represents the
transaction context of the calling thread.
This method never returns null.
getTransaction in interface TransactionManagerTransaction object representing the
transaction associated with the calling thread; never nullSystemException - if this TransactionManager
encounters an unexpected error conditionpublic void resume(Transaction transaction) throws InvalidTransactionException, SystemException
Transaction object.
When this method returns, the calling thread is associated with the transaction context specified.
resume in interface TransactionManagertransaction - the Transaction representing the
transaction to be resumed; must not be nullInvalidTransactionException - if transaction
is invalidIllegalStateException - if the thread is already
associated with another transactionSystemException - if this TransactionManager
encounters an unexpected error conditionpublic void rollback()
throws SystemException
When this method completes, the thread is no longer associated with a transaction.
rollback in interface TransactionManagerSecurityException - if the thread is not allowed to
roll back the transactionIllegalStateException - if the current thread is not
associated with a transactionSystemException - if this TransactionManager
encounters an unexpected error conditionpublic void setRollbackOnly()
throws SystemException
setRollbackOnly in interface TransactionManagerIllegalStateException - if the current thread is not
associated with a transactionSystemException - if this TransactionManager
encounters an unexpected error conditionpublic void setTransactionTimeout(int seconds)
throws SystemException
begin() method.
If an application has not called this method, the transaction service uses some default value for the transaction timeout.
setTransactionTimeout in interface TransactionManagerseconds - the timeout in seconds; if the value is zero,
the transaction service restores the default value; if the
value is negative a SystemException is thrownSystemException - if this TransactionManager
encounters an unexpected error condition or if seconds
is less than zeropublic Transaction suspend() throws SystemException
Transaction that represents the
transaction context being suspended, or null if the
calling thread is not associated with a transaction.
This method may return null.
When this method returns, the calling thread is no longer associated with a transaction.
suspend in interface TransactionManagerTransaction representing the suspended
transaction, or nullSystemException - if this TransactionManager
encounters an unexpected error conditionCopyright © 2018–2019 Oracle and/or its affiliates. All rights reserved. Use is subject to license terms.