org.jboss.jca.core.connectionmanager.transaction

## Class TransactionSynchronizer

- java.lang.Object
- - org.jboss.jca.core.connectionmanager.transaction.TransactionSynchronizer

- All Implemented Interfaces:
    javax.transaction.Synchronization

      public class TransactionSynchronizer
      extends java.lang.Object
      implements javax.transaction.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$
  Author:
    Adrian Brock, gurkanerdogdu

- - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addEnlisted(javax.transaction.Synchronization synch)` The synchronization is now enlisted
    `void` | `addUnenlisted(javax.transaction.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 javax.transaction.Synchronization` | `getCCMSynchronization(javax.transaction.Transaction tx, org.jboss.jca.core.spi.transaction.TransactionIntegration ti)` Check whether we have a CCM synchronization
    `static TransactionSynchronizer` | `getRegisteredSynchronizer(javax.transaction.Transaction tx, org.jboss.jca.core.spi.transaction.TransactionIntegration ti)` Get a registered transaction synchronizer.
    `java.util.List<javax.transaction.Synchronization>` | `getUnenlisted()` Get the unenlisted synchronizations and say we are enlisting if some are returned.
    `protected void` | `invokeAfter(javax.transaction.Synchronization synch, int status)` Invoke an afterCompletion
    `protected void` | `invokeBefore(javax.transaction.Synchronization synch)` Invoke a beforeCompletion
    `static void` | `lock(javax.transaction.Transaction tx, org.jboss.jca.core.spi.transaction.TransactionIntegration ti)` Lock for the given transaction
    `static void` | `registerCCMSynchronization(javax.transaction.Transaction tx, javax.transaction.Synchronization synch, org.jboss.jca.core.spi.transaction.TransactionIntegration ti)` Register a new CCM synchronization
    `boolean` | `removeEnlisted(javax.transaction.Synchronization synch)` Remove an enlisted synchronization
    `static void` | `unlock(javax.transaction.Transaction tx, org.jboss.jca.core.spi.transaction.TransactionIntegration ti)` 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(javax.transaction.Synchronization synch)

      Add a new Tx synchronization that has not been enlisted
      Parameters:
        `synch` - the synchronization

    - #### getUnenlisted

          public java.util.List<javax.transaction.Synchronization> getUnenlisted()

      Get the unenlisted synchronizations and say we are enlisting if some are returned.
      Returns:
        the unenlisted synchronizations

    - #### addEnlisted

          public void addEnlisted(javax.transaction.Synchronization synch)

      The synchronization is now enlisted
      Parameters:
        `synch` - the synchronization

    - #### removeEnlisted

          public boolean removeEnlisted(javax.transaction.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(javax.transaction.Transaction tx,
                                                                          org.jboss.jca.core.spi.transaction.TransactionIntegration ti)
                                                                   throws javax.transaction.SystemException,
                                                                          javax.transaction.RollbackException

      Get a registered transaction synchronizer.
      Parameters:
        `tx` - the transaction
        `ti` - the transaction integration
      Returns:
        the registered transaction synchronizer for this transaction
      Throws:
        `javax.transaction.SystemException` - sys. exception
        `javax.transaction.RollbackException` - rollback exception

    - #### getCCMSynchronization

          public static javax.transaction.Synchronization getCCMSynchronization(javax.transaction.Transaction tx,
                                                                                org.jboss.jca.core.spi.transaction.TransactionIntegration ti)

      Check whether we have a CCM synchronization
      Parameters:
        `tx` - the transaction
        `ti` - the transaction integration
      Returns:
        synch

    - #### registerCCMSynchronization

          public static void registerCCMSynchronization(javax.transaction.Transaction tx,
                                                        javax.transaction.Synchronization synch,
                                                        org.jboss.jca.core.spi.transaction.TransactionIntegration ti)
                                                 throws java.lang.Exception

      Register a new CCM synchronization
      Parameters:
        `tx` - the transaction
        `synch` - the synchronization
        `ti` - the transaction integration
      Throws:
        `java.lang.Exception` - e

    - #### lock

          public static void lock(javax.transaction.Transaction tx,
                                  org.jboss.jca.core.spi.transaction.TransactionIntegration ti)
                           throws javax.transaction.SystemException,
                                  javax.transaction.RollbackException

      Lock for the given transaction
      Parameters:
        `tx` - the transaction
        `ti` - the transaction integration
      Throws:
        `javax.transaction.SystemException` - sys. exception
        `javax.transaction.RollbackException` - rollback exception

    - #### unlock

          public static void unlock(javax.transaction.Transaction tx,
                                    org.jboss.jca.core.spi.transaction.TransactionIntegration ti)

      Unlock for the given transaction
      Parameters:
        `tx` - the transaction
        `ti` - the transaction integration

    - #### beforeCompletion

          public void beforeCompletion()

      Specified by:
        `beforeCompletion` in interface `javax.transaction.Synchronization`

    - #### afterCompletion

          public void afterCompletion(int status)

      Specified by:
        `afterCompletion` in interface `javax.transaction.Synchronization`

    - #### invokeBefore

          protected void invokeBefore(javax.transaction.Synchronization synch)

      Invoke a beforeCompletion
      Parameters:
        `synch` - the synchronization

    - #### invokeAfter

          protected void invokeAfter(javax.transaction.Synchronization synch,
                                     int status)

      Invoke an afterCompletion
      Parameters:
        `synch` - the synchronization
        `status` - the status of the transaction

Copyright © 2014 IronJacamar (http://www.ironjacamar.org)