public abstract class AbstractTransactionController extends java.lang.Object implements ExternalTransactionController
Purpose: Abstract implementation of an ExternalTransactionController.
Description: This class implements the ExternalTransactionController interface. Concrete implementations of this class are responsible for performing the coordination with the external transaction manager through whatever means available to that manager. Different transaction services may do this in slightly different ways, but most common ones (JTA and JTS/OTS) will use a synchronization interface.
Constructor and Description |
---|
AbstractTransactionController()
INTERNAL: Return a new controller.
|
Modifier and Type | Method and Description |
---|---|
void |
addUnitOfWork(java.lang.Object transactionKey, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl activeUnitOfWork)
INTERNAL: Add a UnitOfWork object to the Hashtable keyed on the external transaction object.
|
void |
beginTransaction(org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: Begin an external transaction.
|
void |
bindToCurrentTransaction(org.eclipse.persistence.internal.sessions.UnitOfWorkImpl unitOfWork, org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: Associate the given unit of work and EclipseLink session with the active external transaction.
|
void |
clearSequencingListeners()
INTERNAL: Clears sequencing listeners.
|
void |
commitTransaction(org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: Commit the external transaction.
|
org.eclipse.persistence.internal.sequencing.SequencingCallback |
getActiveSequencingCallback(DatabaseSession dbSession, org.eclipse.persistence.internal.sequencing.SequencingCallbackFactory sequencingCallbackFactory)
INTERNAL: Returns sequencingCallback for the current active external transaction.
|
org.eclipse.persistence.internal.sessions.UnitOfWorkImpl |
getActiveUnitOfWork()
INTERNAL: Return the active unit of work for the current external transaction.
|
ExceptionHandler |
getExceptionHandler()
Return the exception handler used to handle or wrap exceptions thrown in before/after completion.
|
SynchronizationListenerFactory |
getListenerFactory()
INTERNAL: Get the factory used to generate synchronization listeners.
|
org.eclipse.persistence.internal.sessions.AbstractSession |
getSession()
INTERNAL: Return the manager's session.
|
java.lang.Object |
getTransaction()
INTERNAL: Return the active external transaction object, or null if none is active.
|
java.lang.Object |
getTransactionKey(java.lang.Object transaction)
INTERNAL: Return a key for the specified external transaction object.
|
java.lang.Object |
getTransactionStatus()
INTERNAL: Return the transaction status.
|
java.util.Map |
getUnitsOfWork()
INTERNAL: Return the hashtable keyed on the external transaction objects with values that are the associated units of work.
|
boolean |
hasActiveUnitOfWork()
INTERNAL: Return true if there is a unit of work associated with the active external transaction.
|
void |
initializeSequencingListeners()
INTERNAL: Initializes sequencing listeners.
|
abstract boolean |
isRolledBack_impl(java.lang.Object status)
INTERNAL: Return true if the transaction is in the rolled back state.
|
boolean |
isSequencingCallbackRequired()
INTERNAL: Indicates whether sequencing callback may be required.
|
java.lang.Object |
jndiLookup(java.lang.String jndiName)
PUBLIC: Look up a given name in JNDI.
|
void |
logTxStateTrace(org.eclipse.persistence.internal.sessions.AbstractSession session, java.lang.String msgInd, java.lang.Object status) |
void |
logTxTrace(org.eclipse.persistence.internal.sessions.AbstractSession session, java.lang.String msgInd, java.lang.Object[] args) |
org.eclipse.persistence.internal.sessions.UnitOfWorkImpl |
lookupActiveUnitOfWork()
INTERNAL: Return the unit of work associated with the active external transaction.
|
org.eclipse.persistence.internal.sessions.UnitOfWorkImpl |
lookupActiveUnitOfWork(java.lang.Object transaction)
INTERNAL: Return the unit of work associated with the active external transaction.
|
void |
markTransactionForRollback()
INTERNAL: Mark the external transaction for rollback.
|
boolean |
noTransactionOrRolledBackOrCommited()
INTERNAL: Used the EJB 3.0 to determine if a transaction is in a state where an EntityManager can be closed
|
int |
numSessionsRequiringSequencingCallback()
INTERNAL: Indicates how many sessions require sequencing callbacks.
|
void |
registerSynchronizationListener(org.eclipse.persistence.internal.sessions.UnitOfWorkImpl uow, org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: Associate the given unit of work and EclipseLink session with the current external transaction.
|
void |
removeSequencingListener(java.lang.Object transactionKey)
INTERNAL: Clears sequencingCallbacks.
|
void |
removeUnitOfWork(java.lang.Object transactionKey)
INTERNAL: Remove the unit of work associated with the transaction passed in.
|
void |
rollbackTransaction(org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: Roll back the external transaction.
|
void |
setExceptionHandler(ExceptionHandler exceptionHandler)
Set an exception handler to handle or wrap exceptions thrown in before/after completion.
|
void |
setListenerFactory(SynchronizationListenerFactory factory)
INTERNAL: Set the factory used to generate synchronization listeners.
|
void |
setSession(org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: Set the manager's session.
|
public AbstractTransactionController()
public ExceptionHandler getExceptionHandler()
getExceptionHandler
in interface ExternalTransactionController
public void setExceptionHandler(ExceptionHandler exceptionHandler)
setExceptionHandler
in interface ExternalTransactionController
public void bindToCurrentTransaction(org.eclipse.persistence.internal.sessions.UnitOfWorkImpl unitOfWork, org.eclipse.persistence.internal.sessions.AbstractSession session)
unitOfWork
- The unit of work that is to be bound to the active transactionsession
- The session ancestor of the unit of workpublic void beginTransaction(org.eclipse.persistence.internal.sessions.AbstractSession session)
beginTransaction
in interface ExternalTransactionController
session
- The session for which the transaction is being begun.public void commitTransaction(org.eclipse.persistence.internal.sessions.AbstractSession session)
commitTransaction
in interface ExternalTransactionController
session
- The session for which the transaction is being committed.public void rollbackTransaction(org.eclipse.persistence.internal.sessions.AbstractSession session)
rollbackTransaction
in interface ExternalTransactionController
session
- The session for which the transaction is being rolled back.public void markTransactionForRollback()
markTransactionForRollback
in interface ExternalTransactionController
public java.lang.Object getTransaction()
public java.lang.Object getTransactionKey(java.lang.Object transaction)
public java.lang.Object getTransactionStatus()
public boolean noTransactionOrRolledBackOrCommited()
public abstract boolean isRolledBack_impl(java.lang.Object status)
public boolean hasActiveUnitOfWork()
public org.eclipse.persistence.internal.sessions.UnitOfWorkImpl getActiveUnitOfWork()
getActiveUnitOfWork
in interface ExternalTransactionController
public org.eclipse.persistence.internal.sessions.UnitOfWorkImpl lookupActiveUnitOfWork()
public org.eclipse.persistence.internal.sessions.UnitOfWorkImpl lookupActiveUnitOfWork(java.lang.Object transaction)
public void addUnitOfWork(java.lang.Object transactionKey, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl activeUnitOfWork)
public void removeUnitOfWork(java.lang.Object transactionKey)
public org.eclipse.persistence.internal.sessions.AbstractSession getSession()
getSession
in interface ExternalTransactionController
public void setSession(org.eclipse.persistence.internal.sessions.AbstractSession session)
setSession
in interface ExternalTransactionController
public java.util.Map getUnitsOfWork()
public SynchronizationListenerFactory getListenerFactory()
public void setListenerFactory(SynchronizationListenerFactory factory)
public void registerSynchronizationListener(org.eclipse.persistence.internal.sessions.UnitOfWorkImpl uow, org.eclipse.persistence.internal.sessions.AbstractSession session) throws DatabaseException
registerSynchronizationListener
in interface ExternalTransactionController
DatabaseException
public java.lang.Object jndiLookup(java.lang.String jndiName)
The lookup assumes that it is taking place on the server side, and that the InitialContext can be used without requiring any special properties.
jndiName
- The name to look upTransactionException
- Thrown in case of lookup failurepublic void initializeSequencingListeners()
initializeSequencingListeners
in interface ExternalTransactionController
public org.eclipse.persistence.internal.sequencing.SequencingCallback getActiveSequencingCallback(DatabaseSession dbSession, org.eclipse.persistence.internal.sequencing.SequencingCallbackFactory sequencingCallbackFactory)
getActiveSequencingCallback
in interface ExternalTransactionController
public void clearSequencingListeners()
clearSequencingListeners
in interface ExternalTransactionController
public boolean isSequencingCallbackRequired()
public int numSessionsRequiringSequencingCallback()
public void removeSequencingListener(java.lang.Object transactionKey)
public void logTxTrace(org.eclipse.persistence.internal.sessions.AbstractSession session, java.lang.String msgInd, java.lang.Object[] args)
public void logTxStateTrace(org.eclipse.persistence.internal.sessions.AbstractSession session, java.lang.String msgInd, java.lang.Object status)