@Override
   public void registerSynchronization(Synchronization sync)
         throws RollbackException, IllegalStateException, SystemException {
      if (trace) {
         log.tracef("Transaction.registerSynchronization(%s) invoked in transaction with Xid=%s", sync, xid);
      }
      checkStatusBeforeRegister("synchronization");
      if (trace) {
         log.tracef("Registering synchronization handler %s", sync);
      }
      synchronized (xidLock) {
         syncs.add(sync);
      }
   }
@ Override public void registerSynchronization ( Synchronization sync ) throws RollbackException , IllegalStateException , SystemException { if ( trace ) { log . tracef ( "Transaction.registerSynchronization(%s) invoked in transaction with Xid=%s" , sync , xid ) ; } checkStatusBeforeRegister ( "synchronization" ) ; if ( trace ) { log . tracef ( "Registering synchronization handler %s" , sync ) ; } synchronized ( xidLock ) { syncs . add ( sync ) ; } }
Register a {@link Synchronization} callback with this transaction.

@throws RollbackException     If the transaction is marked for rollback only.
@throws IllegalStateException If the transaction is in a state where {@link Synchronization} callbacks cannot be
registered. This could be because the transaction is no longer active, or because it
is in the {@link Status#STATUS_PREPARED prepared state}.
@throws SystemException       If the transaction service fails in an unexpected way.