The before_completion() method is invoked after the application invokes commit(), but before the VisiTransact Transaction Service begins transaction completion. The 
before_completion() method is not invoked for a rollback request. The 
after_completion() method is always invoked during normal processing.
 
      With the before_completion() method, Synchronization objects can perform processing after the work of a transaction has been done, but before the commit protocol starts (i.e. before 
prepare() or 
commit_one_phase). For example, you can:
 
      With the after_completion() method, Synchronization objects can do work after the transaction has been completed; that is, after the Terminator tells Resources to 
commit(), rollback(), or 
commit_one_phase(). You might use Synchronization objects to perform the following types of actions:
 
      You register a Synchronization object with the CosTransactions::Coordinator using one of the following methods:
 
      When a Synchronization object has been registered and a request to commit the transaction is made, the Terminator automatically invokes before_completion() on any Synchronization objects before actually performing the completion. You determine what happens during the 
before_completion() invocation from within your Synchronization object. When all registered Synchronization objects have completed, the Terminator proceeds with its transaction completion. A rollback can be ensured by invoking 
rollback_only() (on the 
VISTransactions::Current or 
CosTransactions::Coordinator) from a 
before_completion() method. Additionally, any exception thrown by a 
before_completion() method (including 
CORBA::TRANSACTION_ROLLEDBACK) will cause the transaction to be rolled back.
 
      If any of the Synchronization objects mark the transaction for rollback, the Terminator stops invoking before_completion() on the remaining Synchronization objects. Because any Synchronization object can invoke 
rollback_only(), invoking 
commit() does not guarantee the transaction will commit.
 
      The next time the Terminator interacts with Synchronization objects is after transaction completion; that is, it has received all commit(), 
commit_one_phase(), or 
rollback() responses from Resource objects. At this time, the Terminator automatically invokes 
after_completion() on all registered Synchronization objects and passes them the transaction outcome as status. You determine what happens during the 
after_completion() invocation from within your Synchronization object.
 
      If a Synchronization object is unavailable when the Terminator attempts to invoke its before_completion() method, the transaction will be rolled back. Any Synchronization objects that have not been contacted will not have 
before_completion() invoked on them. If any Synchronization object is unavailable when the VisiTransact Transaction Service tries to invoke 
after_completion(), it is ignored.
 
      If you want your transactional object to be notified of the outcome of a transaction, it must provide a Synchronization interface. The VisiTransact Transaction Service notifies Synchronization objects of how a transaction completed when it invokes the 
after_completion() method.