Class AbstractSynchronizationListener

  • Direct Known Subclasses:
    JTASynchronizationListener

    public abstract class AbstractSynchronizationListener
    extends java.lang.Object

    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:
    AbstractTransactionController
    • Field Detail

      • controller

        protected AbstractTransactionController controller
        The external txn controller that is intimate with the transaction manager and knows how to do things like rolling back transactions, etc.
      • unitOfWork

        protected UnitOfWorkImpl unitOfWork
        The 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

        protected java.lang.Object transaction
        The global transaction object.
      • transactionKey

        protected java.lang.Object transactionKey
        The global transaction key.
      • sequencingCallback

        protected SequencingCallback sequencingCallback
        sequencingCallback used in case listener has a single callback.
      • sequencingCallbackMap

        protected java.util.Map<DatabaseSession,​SequencingCallback> sequencingCallbackMap
        sequencingCallbackMap used in case listener has more than one callback: SessionBroker with at least two members requiring callbacks.
    • Constructor Detail

      • AbstractSynchronizationListener

        public AbstractSynchronizationListener()
        INTERNAL:
    • Method Detail

      • 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.
      • afterCompletion

        public void afterCompletion​(java.lang.Object status)
        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

        public void handleException​(java.lang.RuntimeException exception)
        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.
      • getTransaction

        protected java.lang.Object getTransaction()
      • setTransaction

        protected void setTransaction​(java.lang.Object transaction)
      • getTransactionKey

        protected java.lang.Object getTransactionKey()
      • setTransactionKey

        protected void setTransactionKey​(java.lang.Object transactionKey)
      • setUnitOfWork

        protected void setUnitOfWork​(UnitOfWorkImpl unitOfWork)
      • callSequencingCallback

        protected void callSequencingCallback()