Name

Synchronization

Synopsis

A Synchronization object is used to get notification of the end of transactions. The Synchronization interface must be implemented by a concrete application class, which can then be used to request callbacks from the transaction manager. The Synchronization object is registered with an active transaction by calling the Transaction.registerSynchronization() method, passing in the Synchronization object. An exception is thrown if the transaction isn’t active, or has already been marked for rollback. Before the transaction manager starts the commit on the transaction, it calls the beforeCompletion() method on any registered Synchronization objects. After the transaction completes, the transaction manager calls the afterCompletion() method.

public interface Synchronization {
// Public Instance Methods
   public abstract void afterCompletion( int status);  
   public abstract void beforeCompletion();  
}

Passed To

Transaction.registerSynchronization()

Get Java Enterprise in a Nutshell, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.