Module eclipselink
Class AbstractSynchronizationListener
java.lang.Object
org.eclipse.persistence.transaction.AbstractSynchronizationListener
- All Implemented Interfaces:
jakarta.transaction.Synchronization
- Direct Known Subclasses:
JTASynchronizationListener
public abstract class AbstractSynchronizationListener
extends Object
implements jakarta.transaction.Synchronization
Purpose: Abstract Synchronization Listener class
Description: This abstract class is paired with the AbstractTransactionController class. It contains most of the implementation logic to handle callback notifications from an external transaction manager to ensure consistency between the global transaction and the EclipseLink unit of work. It does not assume any particular specification or interface, but can be called by any implementation subclass.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected AbstractTransactionControllerThe external txn controller that is intimate with the transaction manager and knows how to do things like rolling back transactions, etc.protected org.eclipse.persistence.internal.sequencing.SequencingCallbacksequencingCallback used in case listener has a single callback.protected Map<DatabaseSession, org.eclipse.persistence.internal.sequencing.SequencingCallback> sequencingCallbackMap used in case listener has more than one callback: SessionBroker with at least two members requiring callbacks.protected org.eclipse.persistence.internal.sessions.AbstractSessionThe parent of the uow.protected ObjectThe global transaction object.protected ObjectThe global transaction key.protected org.eclipse.persistence.internal.sessions.UnitOfWorkImplThe unit of work associated with the global txn that this listener is bound to. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedINTERNAL:protectedAbstractSynchronizationListener(org.eclipse.persistence.internal.sessions.UnitOfWorkImpl unitOfWork, org.eclipse.persistence.internal.sessions.AbstractSession session, Object transaction, AbstractTransactionController controller) INTERNAL: -
Method Summary
Modifier and TypeMethodDescriptionvoidafterCompletion(Object status) INTERNAL: The method performs the logic that should be executed after the transaction has been completed.voidINTERNAL: This method performs the logic that occurs at transaction completion time.protected voidorg.eclipse.persistence.internal.sequencing.SequencingCallbackgetSequencingCallback(DatabaseSession dbSession, org.eclipse.persistence.internal.sequencing.SequencingCallbackFactory sequencingCallbackFactory) Return sequencingCallback corresponding to the passed session.protected org.eclipse.persistence.internal.sessions.AbstractSessionprotected Objectprotected AbstractTransactionControllerprotected Objectprotected org.eclipse.persistence.internal.sessions.UnitOfWorkImplvoidhandleException(RuntimeException exception) INTERNAL: Do the appropriate thing for when an exception occurs during SQL issuance.protected voidsetSession(org.eclipse.persistence.internal.sessions.AbstractSession session) protected voidsetTransaction(Object transaction) protected voidsetTransactionController(AbstractTransactionController newController) protected voidsetTransactionKey(Object transactionKey) protected voidsetUnitOfWork(org.eclipse.persistence.internal.sessions.UnitOfWorkImpl unitOfWork) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface jakarta.transaction.Synchronization
afterCompletion
-
Field Details
-
controller
The external txn controller that is intimate with the transaction manager and knows how to do things like rolling back transactions, etc. -
session
protected org.eclipse.persistence.internal.sessions.AbstractSession sessionThe parent of the uow. -
unitOfWork
protected org.eclipse.persistence.internal.sessions.UnitOfWorkImpl unitOfWorkThe unit of work associated with the global txn that this listener is bound to. Note that unitOfWork is null in case it's a purely sequencing listener. -
transaction
The global transaction object. -
transactionKey
The global transaction key. -
sequencingCallback
protected org.eclipse.persistence.internal.sequencing.SequencingCallback sequencingCallbacksequencingCallback used in case listener has a single callback. -
sequencingCallbackMap
protected Map<DatabaseSession,org.eclipse.persistence.internal.sequencing.SequencingCallback> sequencingCallbackMapsequencingCallbackMap used in case listener has more than one callback: SessionBroker with at least two members requiring callbacks.
-
-
Constructor Details
-
AbstractSynchronizationListener
protected AbstractSynchronizationListener()INTERNAL: -
AbstractSynchronizationListener
protected AbstractSynchronizationListener(org.eclipse.persistence.internal.sessions.UnitOfWorkImpl unitOfWork, org.eclipse.persistence.internal.sessions.AbstractSession session, Object transaction, AbstractTransactionController controller) INTERNAL:
-
-
Method Details
-
beforeCompletion
public void beforeCompletion()INTERNAL: This method performs the logic that occurs at transaction completion time. This includes issuing the SQL, etc. This method executes within the transaction context of the caller of transaction.commit(), or in the case of container-managed transactions, in the context of the method for which the Container started the transaction.- Specified by:
beforeCompletionin interfacejakarta.transaction.Synchronization
-
afterCompletion
INTERNAL: The method performs the logic that should be executed after the transaction has been completed. The status passed in indicates whether the transaction was committed or rolled back. This status flag may be different for different implementations. This method executes without a transaction context.- Parameters:
status- The status code of the transaction completion.
-
handleException
INTERNAL: Do the appropriate thing for when an exception occurs during SQL issuance. The default thing to do is to simply mark the transaction to be rolled back, for those transaction managers that support this, and rethrow the exception. We hope that the exception will do the trick for those that do not allow marking rollback.This method may optionally be overridden by concrete subclass implementations. Different transaction manager vendors may have different reactions to exceptions that get signalled during the commit phase of synchronization.
-
getTransactionController
-
setTransactionController
-
getTransaction
-
setTransaction
-
getTransactionKey
-
setTransactionKey
-
getSession
protected org.eclipse.persistence.internal.sessions.AbstractSession getSession() -
setSession
protected void setSession(org.eclipse.persistence.internal.sessions.AbstractSession session) -
getUnitOfWork
protected org.eclipse.persistence.internal.sessions.UnitOfWorkImpl getUnitOfWork() -
setUnitOfWork
protected void setUnitOfWork(org.eclipse.persistence.internal.sessions.UnitOfWorkImpl unitOfWork) -
callSequencingCallback
protected void callSequencingCallback() -
getSequencingCallback
public org.eclipse.persistence.internal.sequencing.SequencingCallback getSequencingCallback(DatabaseSession dbSession, org.eclipse.persistence.internal.sequencing.SequencingCallbackFactory sequencingCallbackFactory) Return sequencingCallback corresponding to the passed session.
-