public class JTATransactionController extends AbstractTransactionController
Purpose: TransactionController implementation for JTA 1.0
Description: Implements the required behavior for controlling JTA 1.0 transactions. Specific JTA implementations may need to extend this class when special controller behavior is necessary.
The JTA TransactionManager must be obtained and set on the instance in order for a Synchronization listener to be registered against the transaction. This can be done either by extending this class and defining acquireTransactionManager() to return the manager for the server, or by using this class and explicitly calling the setTransactionManager() method on it after the fact. e.g. TransactionManager mgr = controller.jndiLookup("java:comp/TransactionManager"); controller.setTransactionManager(mgr);
If a different listener needs to be used for synchronization, the SynchronizationListenerFactory should be set on the controller instance. The listener subclass should implement the factory interface, so that setting the factory is simply a matter of assigning an instance of the listener. e.g. controller.setSynchronizationListenerFactory( new DifferentServerSynchronizationListener()); The default listener factory creates instances of JTATransactionListener.
| Modifier and Type | Field and Description |
|---|---|
protected static jakarta.transaction.TransactionManager |
defaultTransactionManager |
protected jakarta.transaction.TransactionManager |
transactionManager |
activeUnitOfWorkThreadLocal, currentlyProcessedListeners, exceptionHandler, listenerFactory, numSessionsRequiringSequencingCallback, sequencingListeners, session, unitsOfWork| Constructor and Description |
|---|
JTATransactionController()
PUBLIC:
Return a new controller for use with a JTA 1.0 compliant TransactionManager.
|
JTATransactionController(jakarta.transaction.TransactionManager transactionManager)
PUBLIC:
Return a new controller for use with a JTA 1.0 compliant TransactionManager.
|
| Modifier and Type | Method and Description |
|---|---|
protected jakarta.transaction.TransactionManager |
acquireTransactionManager()
INTERNAL:
Obtain and return the JTA TransactionManager on this platform.
|
protected void |
beginTransaction_impl()
INTERNAL:
Begin an external transaction.
|
protected boolean |
canBeginTransaction_impl(Object status)
INTERNAL:
Return true if the status indicates that a transaction can be started.
|
protected boolean |
canCommitTransaction_impl(Object status)
INTERNAL:
Return true if the status indicates that a transaction can be committed.
|
protected boolean |
canIssueSQLToDatabase_impl(Object status)
INTERNAL:
Return true if the status indicates that the SQL should be issued to the db.
|
protected boolean |
canMergeUnitOfWork_impl(Object status)
INTERNAL:
Return true if the status indicates that the unit of work should be merged
into the shared cache.
|
protected boolean |
canRollbackTransaction_impl(Object status)
INTERNAL:
Return true if the status indicates that a transaction can be rolled back.
|
protected void |
commitTransaction_impl()
INTERNAL:
Commit the external transaction.
|
static jakarta.transaction.TransactionManager |
getDefaultTransactionManager() |
protected int |
getIntStatus(Object status)
INTERNAL:
Convenience method to return the int value of the transaction status.
|
protected Object |
getTransaction_impl()
INTERNAL:
Return the active external transaction, or null if none is currently
active for this thread.
|
protected Object |
getTransactionKey_impl(Object transaction)
INTERNAL:
Return a key for the specified external transaction object.
|
jakarta.transaction.TransactionManager |
getTransactionManager()
PUBLIC:
Return the transaction manager used to control the JTA transactions.
|
protected Object |
getTransactionStatus_impl()
INTERNAL:
Return the transaction status as an object.
|
boolean |
isRolledBack_impl(Object status)
INTERNAL:
Return true if the transaction is rolled back.
|
protected void |
markTransactionForRollback_impl()
INTERNAL:
Mark the external transaction for rollback.
|
protected void |
registerSynchronization_impl(AbstractSynchronizationListener listener,
Object txn)
INTERNAL:
Register the specified synchronization listener with the given active
transaction.
|
protected void |
rollbackTransaction_impl()
INTERNAL:
Roll back the external transaction.
|
static void |
setDefaultTransactionManager(jakarta.transaction.TransactionManager defaultTransactionManager)
PUBLIC:
Set the JTA transaction manager to be used.
|
void |
setTransactionManager(jakarta.transaction.TransactionManager mgr)
PUBLIC:
Set the transaction manager used to control the JTA transactions.
|
protected String |
statusToString_impl(Object status)
INTERNAL:
Convert the status to a string for tracing.
|
addUnitOfWork, beginTransaction, bindToCurrentTransaction, clearSequencingListeners, commitTransaction, getActiveSequencingCallback, getActiveUnitOfWork, getExceptionHandler, getListenerFactory, getSession, getTransaction, getTransactionKey, getTransactionStatus, getUnitsOfWork, hasActiveUnitOfWork, initializeSequencingListeners, isSequencingCallbackRequired, jndiLookup, logTxStateTrace, logTxTrace, lookupActiveUnitOfWork, lookupActiveUnitOfWork, markTransactionForRollback, noTransactionOrRolledBackOrCommited, numSessionsRequiringSequencingCallback, registerSynchronizationListener, removeSequencingListener, removeUnitOfWork, rollbackTransaction, setExceptionHandler, setListenerFactory, setSession, setUnitsOfWorkprotected static jakarta.transaction.TransactionManager defaultTransactionManager
protected jakarta.transaction.TransactionManager transactionManager
public JTATransactionController()
public JTATransactionController(jakarta.transaction.TransactionManager transactionManager)
protected void registerSynchronization_impl(AbstractSynchronizationListener listener, Object txn) throws Exception
registerSynchronization_impl in class AbstractTransactionControllerlistener - The synchronization listener created for this transactiontxn - The active transaction for which notification is being requestedExceptionprotected Object getTransaction_impl() throws Exception
getTransaction_impl in class AbstractTransactionControllerExceptionprotected Object getTransactionKey_impl(Object transaction) throws Exception
getTransactionKey_impl in class AbstractTransactionControllertransaction - The transaction to which the returned key applies (may be null)Exceptionprotected Object getTransactionStatus_impl() throws Exception
getTransactionStatus_impl in class AbstractTransactionControllerExceptionprotected void beginTransaction_impl()
throws Exception
beginTransaction_impl in class AbstractTransactionControllerExceptionprotected void commitTransaction_impl()
throws Exception
commitTransaction_impl in class AbstractTransactionControllerExceptionprotected void rollbackTransaction_impl()
throws Exception
rollbackTransaction_impl in class AbstractTransactionControllerExceptionprotected void markTransactionForRollback_impl()
throws Exception
markTransactionForRollback_impl in class AbstractTransactionControllerExceptionprotected boolean canBeginTransaction_impl(Object status)
canBeginTransaction_impl in class AbstractTransactionControllerstatus - The current transaction statusprotected boolean canCommitTransaction_impl(Object status)
canCommitTransaction_impl in class AbstractTransactionControllerstatus - The current transaction statusprotected boolean canRollbackTransaction_impl(Object status)
canRollbackTransaction_impl in class AbstractTransactionControllerstatus - The current transaction statusprotected boolean canIssueSQLToDatabase_impl(Object status)
canIssueSQLToDatabase_impl in class AbstractTransactionControllerstatus - The current transaction statusprotected boolean canMergeUnitOfWork_impl(Object status)
canMergeUnitOfWork_impl in class AbstractTransactionControllerstatus - The current transaction statuspublic boolean isRolledBack_impl(Object status)
isRolledBack_impl in class AbstractTransactionControllerprotected jakarta.transaction.TransactionManager acquireTransactionManager()
throws Exception
Exceptionprotected int getIntStatus(Object status)
public jakarta.transaction.TransactionManager getTransactionManager()
public void setTransactionManager(jakarta.transaction.TransactionManager mgr)
mgr - A valid JTA TransactionManager that can be
accessed by this controller to obtain transaction state information and
control the active transaction.protected String statusToString_impl(Object status)
AbstractTransactionControllerstatusToString_impl in class AbstractTransactionControllerpublic static jakarta.transaction.TransactionManager getDefaultTransactionManager()
public static void setDefaultTransactionManager(jakarta.transaction.TransactionManager defaultTransactionManager)
Copyright © 2007–2021 Eclipse.org - EclipseLink Project. All rights reserved.