Class JCAOrderedLastSynchronizationList

java.lang.Object
org.jboss.as.txn.service.internal.tsr.JCAOrderedLastSynchronizationList
All Implemented Interfaces:
jakarta.transaction.Synchronization

public class JCAOrderedLastSynchronizationList extends Object implements jakarta.transaction.Synchronization
This class was added to: 1. workaround an issue discussed in https://java.net/jira/browse/JTA_SPEC-4 whereby the Jakarta Connectors Synchronization(s) need to be called after the Jakarta Persistence Synchronization(s). Currently the implementation orders Jakarta Connectors relative to all interposed Synchronizations, if this is not desirable it would be possible to modify this class to store just the Jakarta Persistence and Jakarta Connectors syncs and the other syncs can simply be passed to a delegate (would need the reference to this in the constructor). 2. During afterCompletion the Jakarta Connectors synchronizations should be called last as that allows Jakarta Connectors to detect connection leaks from frameworks that have not closed the Jakarta Connectors managed resources. This is described in (for example) http://docs.oracle.com/javaee/5/api/javax/transaction/TransactionSynchronizationRegistry .html#registerInterposedSynchronization(jakarta.transaction.Synchronization) where it says that during afterCompletion "Resources can be closed but no transactional work can be performed with them"
  • Constructor Details

    • JCAOrderedLastSynchronizationList

      public JCAOrderedLastSynchronizationList()
  • Method Details

    • registerInterposedSynchronization

      public void registerInterposedSynchronization(jakarta.transaction.Synchronization synchronization) throws IllegalStateException, jakarta.transaction.SystemException
      This is only allowed at various points of the transaction lifecycle.
      Parameters:
      synchronization - The synchronization to register
      Throws:
      IllegalStateException - In case the transaction was in a state that was not valid to register under
      jakarta.transaction.SystemException - In case the transaction status was not known
    • beforeCompletion

      public void beforeCompletion()
      Exceptions from Synchronizations that are registered with this TSR are not trapped for before completion. This is because an error in a Sync here should result in the transaction rolling back. You can see that in effect in these classes: https://github.com/jbosstm/narayana/blob/5.0.4.Final/ArjunaCore/arjuna/classes /com/arjuna/ats/arjuna/coordinator/TwoPhaseCoordinator.java#L91 https://github.com/jbosstm/narayana/blob/5.0.4.Final/ArjunaJTA /jta/classes/com/arjuna/ats/internal/jta/resources/arjunacore/SynchronizationImple.java#L76
      Specified by:
      beforeCompletion in interface jakarta.transaction.Synchronization
    • afterCompletion

      public void afterCompletion(int status)
      Specified by:
      afterCompletion in interface jakarta.transaction.Synchronization