org.jboss.resource.connectionmanager
Class TransactionSynchronizer

java.lang.Object
  extended byorg.jboss.resource.connectionmanager.TransactionSynchronizer
All Implemented Interfaces:
Synchronization (src)

public class TransactionSynchronizer
extends java.lang.Object
implements Synchronization (src)

Organizes transaction synchronization done by JCA.

This class exists to make sure all TxRemover synchronizations are invoked before the cached connection manager closes any closed connections.


Field Summary
protected  Synchronization (src) ccmSynch
          The cached connection manager synchronization
protected  Transaction (src) tx
          The transaction
protected  java.util.ArrayList txRemoverSynchs
          TxRemover synchronizations
protected static TransactionLocal (src) txSynchs
          The transaction synchronizations
 
Method Summary
 void afterCompletion(int status)
          This method is invoked after the transaction has committed or rolled back.
 void beforeCompletion()
          This method is invoked before the start of the commit process.
static Synchronization (src) getCCMSynchronization(Transaction (src)  tx)
          Check whether we have a CCM synchronization
protected static TransactionSynchronizer (src) getRegisteredSynchronizer(Transaction (src)  tx)
          Get a registered transaction synchronizer.
protected  void invokeAfter(Synchronization (src)  synch, int status)
          Invoke an afterCompletion
protected  void invokeBefore(Synchronization (src)  synch)
          Invoke a beforeCompletion
static void registerCCMSynchronization(Transaction (src)  tx, Synchronization (src)  synch)
          Register a new CCM synchronization
static void registerTxRemoverSynchronization(Transaction (src)  tx, Synchronization (src)  synch)
          Register a new TxRemover synchronization
static void setTransactionManager(TransactionManager (src)  tm)
          Initialization
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

txSynchs

protected static TransactionLocal (src)  txSynchs
The transaction synchronizations


tx

protected Transaction (src)  tx
The transaction


txRemoverSynchs

protected java.util.ArrayList txRemoverSynchs
TxRemover synchronizations


ccmSynch

protected Synchronization (src)  ccmSynch
The cached connection manager synchronization

Method Detail

setTransactionManager

public static void setTransactionManager(TransactionManager (src)  tm)
Initialization


registerTxRemoverSynchronization

public static void registerTxRemoverSynchronization(Transaction (src)  tx,
                                                    Synchronization (src)  synch)
                                             throws RollbackException (src) ,
                                                    SystemException (src) 
Register a new TxRemover synchronization

Parameters:
tx - the transaction
synch - the synchronization
Throws:
RolledbackException - if the transaction is already rolled back
SystemException (src) - for an error in the tranaction manager
RollbackException (src)

getCCMSynchronization

public static Synchronization (src)  getCCMSynchronization(Transaction (src)  tx)
Check whether we have a CCM synchronization

Parameters:
tx - the transaction

registerCCMSynchronization

public static void registerCCMSynchronization(Transaction (src)  tx,
                                              Synchronization (src)  synch)
                                       throws RollbackException (src) ,
                                              SystemException (src) 
Register a new CCM synchronization

Parameters:
tx - the transaction
synch - the synchronization
Throws:
RolledbackException - if the transaction is already rolled back
SystemException (src) - for an error in the tranaction manager
RollbackException (src)

beforeCompletion

public void beforeCompletion()
Description copied from interface: Synchronization (src)
This method is invoked before the start of the commit process. The method invocation is done in the context of the transaction that is about to be committed.

Specified by:
beforeCompletion in interface Synchronization (src)

afterCompletion

public void afterCompletion(int status)
Description copied from interface: Synchronization (src)
This method is invoked after the transaction has committed or rolled back.

Specified by:
afterCompletion in interface Synchronization (src)
Parameters:
status - The status of the completed transaction.

invokeBefore

protected void invokeBefore(Synchronization (src)  synch)
Invoke a beforeCompletion

Parameters:
synch - the synchronization

invokeAfter

protected void invokeAfter(Synchronization (src)  synch,
                           int status)
Invoke an afterCompletion

Parameters:
synch - the synchronization
status - the status of the transaction

getRegisteredSynchronizer

protected static TransactionSynchronizer (src)  getRegisteredSynchronizer(Transaction (src)  tx)
                                                            throws RollbackException (src) ,
                                                                   SystemException (src) 
Get a registered transaction synchronizer.

Parameters:
tx - the transaction
Returns:
the registered transaction synchronizer for this transaction
Throws:
RolledbackException - if the transaction is already rolled back
SystemException (src) - for an error in the tranaction manager
RollbackException (src)