|
EclipseLink 2.2.0, build 'v20110202-r8913' API Reference | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.eclipse.persistence.transaction.AbstractTransactionController
public abstract class AbstractTransactionController
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.
AbstractSynchronizationListener
,
ExternalTransactionController
Field Summary | |
---|---|
protected java.lang.ThreadLocal |
activeUnitOfWorkThreadLocal
PERF: Cache the active uow in a thread local. |
protected java.util.Map<java.lang.Object,AbstractSynchronizationListener> |
currentlyProcessedListeners
Non-null only in case sequencing callbacks are used: numSessionsRequiringSequencingCallback > 0 |
protected SynchronizationListenerFactory |
listenerFactory
Generates listener instances for synchronization |
protected int |
numSessionsRequiringSequencingCallback
more - the session is a session broker with several members requiring sequencing callbacks. |
protected java.util.Map<java.lang.Object,AbstractSynchronizationListener> |
sequencingListeners
Non-null only in case sequencing callbacks are used: numSessionsRequiringSequencingCallback > 0 |
protected org.eclipse.persistence.internal.sessions.AbstractSession |
session
The session this controller is responsible for controlling |
protected java.util.Map |
unitsOfWork
Table of external transaction object keys and unit of work values |
Constructor Summary | |
---|---|
AbstractTransactionController()
INTERNAL: Return a new controller. |
Method Summary | |
---|---|
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. |
protected abstract void |
beginTransaction_impl()
INTERNAL: Begin an external transaction. |
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. |
protected abstract boolean |
canBeginTransaction_impl(java.lang.Object status)
INTERNAL: Return true if the status indicates that a transaction can be started. |
protected abstract boolean |
canCommitTransaction_impl(java.lang.Object status)
INTERNAL: Return true if the status indicates that a transaction can be committed. |
protected abstract boolean |
canIssueSQLToDatabase_impl(java.lang.Object status)
INTERNAL: Return true if the status indicates that the SQL should be issued to the db. |
protected abstract boolean |
canMergeUnitOfWork_impl(java.lang.Object status)
INTERNAL: Return true if the status indicates that the unit of work should be merged into the shared cache. |
protected abstract boolean |
canRollbackTransaction_impl(java.lang.Object status)
INTERNAL: Return true if the status indicates that a transaction can be rolled back. |
void |
clearSequencingListeners()
INTERNAL: Clears sequencing listeners. |
protected abstract void |
commitTransaction_impl()
INTERNAL: Commit the external transaction. |
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. |
SynchronizationListenerFactory |
getListenerFactory()
INTERNAL: Get the factory used to generate synchronization listeners. |
org.eclipse.persistence.internal.sessions.AbstractSession |
getSession()
INTERNAL: Return the manager's session. |
protected abstract java.lang.Object |
getTransaction_impl()
INTERNAL: Return the active external transaction for the calling thread, or null if none is currently active for this thread. |
java.lang.Object |
getTransaction()
INTERNAL: Return the active external transaction object, or null if none is active. |
protected abstract java.lang.Object |
getTransactionKey_impl(java.lang.Object transaction)
INTERNAL: Return a key for the specified external transaction object. |
java.lang.Object |
getTransactionKey(java.lang.Object transaction)
INTERNAL: Return a key for the specified external transaction object. |
protected abstract java.lang.Object |
getTransactionStatus_impl()
INTERNAL: Return the transaction status. |
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. |
protected abstract void |
markTransactionForRollback_impl()
INTERNAL: Mark the external transaction for rollback. |
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. |
protected abstract void |
registerSynchronization_impl(AbstractSynchronizationListener listener,
java.lang.Object txn)
INTERNAL: Register the specified synchronization listener with the given active transaction. |
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. |
protected abstract void |
rollbackTransaction_impl()
INTERNAL: Roll back the external transaction. |
void |
rollbackTransaction(org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: Roll back the external transaction. |
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. |
protected void |
setUnitsOfWork(java.util.Map unitsOfWork)
INTERNAL: Set the table of transactions to units of work. |
protected abstract java.lang.String |
statusToString_impl(java.lang.Object status)
INTERNAL: Convert the status to a string for tracing. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.util.Map unitsOfWork
protected org.eclipse.persistence.internal.sessions.AbstractSession session
protected SynchronizationListenerFactory listenerFactory
protected java.lang.ThreadLocal activeUnitOfWorkThreadLocal
protected java.util.Map<java.lang.Object,AbstractSynchronizationListener> sequencingListeners
protected java.util.Map<java.lang.Object,AbstractSynchronizationListener> currentlyProcessedListeners
protected int numSessionsRequiringSequencingCallback
Constructor Detail |
---|
public AbstractTransactionController()
Method Detail |
---|
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()
protected void setUnitsOfWork(java.util.Map unitsOfWork)
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 up
TransactionException
- 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)
protected abstract void registerSynchronization_impl(AbstractSynchronizationListener listener, java.lang.Object txn) throws java.lang.Exception
listener
- The synchronization listener created for this transactiontxn
- The active transaction for which notification is being requested
java.lang.Exception
protected abstract java.lang.Object getTransaction_impl() throws java.lang.Exception
java.lang.Exception
protected abstract java.lang.Object getTransactionKey_impl(java.lang.Object transaction) throws java.lang.Exception
transaction
- The transaction to which the returned key applies (may be null)
java.lang.Exception
protected abstract java.lang.Object getTransactionStatus_impl() throws java.lang.Exception
java.lang.Exception
protected abstract void beginTransaction_impl() throws java.lang.Exception
java.lang.Exception
protected abstract void commitTransaction_impl() throws java.lang.Exception
java.lang.Exception
protected abstract void rollbackTransaction_impl() throws java.lang.Exception
java.lang.Exception
protected abstract void markTransactionForRollback_impl() throws java.lang.Exception
java.lang.Exception
protected abstract boolean canBeginTransaction_impl(java.lang.Object status)
status
- The current transaction status
protected abstract boolean canCommitTransaction_impl(java.lang.Object status)
status
- The current transaction status
protected abstract boolean canRollbackTransaction_impl(java.lang.Object status)
status
- The current transaction status
protected abstract boolean canIssueSQLToDatabase_impl(java.lang.Object status)
status
- The current transaction status
protected abstract boolean canMergeUnitOfWork_impl(java.lang.Object status)
status
- The current transaction status
protected abstract java.lang.String statusToString_impl(java.lang.Object status)
|
EclipseLink 2.2.0, build 'v20110202-r8913' API Reference | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |