org.jboss.jca.core.connectionmanager.transaction
Class TransactionSynchronizer

java.lang.Object
  extended by org.jboss.jca.core.connectionmanager.transaction.TransactionSynchronizer
All Implemented Interfaces:
Synchronization

public class TransactionSynchronizer
extends Object
implements Synchronization

Organizes transaction synchronization done by JCA.

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

Version:
$Rev: 111562 $
Author:
Adrian Brock, gurkanerdogdu

Method Summary
 void addEnlisted(Synchronization synch)
          The synchronization is now enlisted
 void addUnenlisted(Synchronization synch)
          Add a new Tx synchronization that has not been enlisted
 void afterCompletion(int status)
          
 void beforeCompletion()
          
 void enlisted()
          This thread has finished enlisting.
static Synchronization getCCMSynchronization(Transaction tx)
          Check whether we have a CCM synchronization
static TransactionSynchronizer getRegisteredSynchronizer(Transaction tx, TransactionSynchronizationRegistry tsr)
          Get a registered transaction synchronizer.
 List<Synchronization> getUnenlisted()
          Get the unenlisted synchronizations and say we are enlisting if some are returned.
protected  void invokeAfter(Synchronization synch, int status)
          Invoke an afterCompletion
protected  void invokeBefore(Synchronization synch)
          Invoke a beforeCompletion
static void lock(Transaction tx)
          Lock for the given transaction
static void registerCCMSynchronization(Transaction tx, Synchronization synch, TransactionSynchronizationRegistry tsr)
          Register a new CCM synchronization
 boolean removeEnlisted(Synchronization synch)
          Remove an enlisted synchronization
static void unlock(Transaction tx)
          Unlock for the given transaction
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

addUnenlisted

public void addUnenlisted(Synchronization synch)
Add a new Tx synchronization that has not been enlisted

Parameters:
synch - the synchronization

getUnenlisted

public List<Synchronization> getUnenlisted()
Get the unenlisted synchronizations and say we are enlisting if some are returned.

Returns:
the unenlisted synchronizations

addEnlisted

public void addEnlisted(Synchronization synch)
The synchronization is now enlisted

Parameters:
synch - the synchronization

removeEnlisted

public boolean removeEnlisted(Synchronization synch)
Remove an enlisted synchronization

Parameters:
synch - the synchronization
Returns:
true when the synchronization was enlisted

enlisted

public void enlisted()
This thread has finished enlisting.


getRegisteredSynchronizer

public static TransactionSynchronizer getRegisteredSynchronizer(Transaction tx,
                                                                TransactionSynchronizationRegistry tsr)
                                                         throws SystemException,
                                                                RollbackException
Get a registered transaction synchronizer.

Parameters:
tx - the transaction
tsr - the transaction synchronization registry
Returns:
the registered transaction synchronizer for this transaction
Throws:
SystemException - sys. exception
RollbackException - rollback exception

getCCMSynchronization

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

Parameters:
tx - the transaction
Returns:
synch

registerCCMSynchronization

public static void registerCCMSynchronization(Transaction tx,
                                              Synchronization synch,
                                              TransactionSynchronizationRegistry tsr)
                                       throws Exception
Register a new CCM synchronization

Parameters:
tx - the transaction
synch - the synchronization
tsr - the transaction synchronization registry
Throws:
Exception - e

lock

public static void lock(Transaction tx)
Lock for the given transaction

Parameters:
tx - the transaction

unlock

public static void unlock(Transaction tx)
Unlock for the given transaction

Parameters:
tx - the transaction

beforeCompletion

public void beforeCompletion()

Specified by:
beforeCompletion in interface Synchronization

afterCompletion

public void afterCompletion(int status)

Specified by:
afterCompletion in interface Synchronization

invokeBefore

protected void invokeBefore(Synchronization synch)
Invoke a beforeCompletion

Parameters:
synch - the synchronization

invokeAfter

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

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


Copyright © 2008 Red Hat Middleware LLC (http://www.jboss.com/)