Class JTAJCATransactionImpl

  • All Implemented Interfaces:
    javax.transaction.Synchronization, Transaction

    public class JTAJCATransactionImpl
    extends TransactionImpl
    implements javax.transaction.Synchronization
    A transaction that is synchronised with a Java Transaction Service (JTA) transaction with JCA. It is only used when using the JDO API within a JavaEE environment using the JCA adapter (i.e not for JPA).
    • Field Detail

      • jtaTM

        private javax.transaction.TransactionManager jtaTM
        JTA TransactionManager.
      • jtaTx

        private javax.transaction.Transaction jtaTx
        JTA transaction we currently are synchronized with. Null when there is no JTA transaction active or not yet detected.
      • markedForRollback

        private boolean markedForRollback
    • Constructor Detail

      • JTAJCATransactionImpl

        public JTAJCATransactionImpl​(ExecutionContext ec,
                                     PropertyStore properties)
        Constructor.
        Parameters:
        ec - ExecutionContext
        properties - Properties to use with the transaction
    • Method Detail

      • getIsActive

        public boolean getIsActive()
        Description copied from class: TransactionImpl
        Similar to "isActive" except that it just returns the "active" flag whereas the isActive() method can also embody rejoining to underlying transactions.
        Specified by:
        getIsActive in interface Transaction
        Overrides:
        getIsActive in class TransactionImpl
        Returns:
        The "active" flag
      • isActive

        public boolean isActive()
        Accessor for whether the transaction is active.
        Specified by:
        isActive in interface Transaction
        Overrides:
        isActive in class TransactionImpl
        Returns:
        Whether the transaction is active.
      • joinTransaction

        private void joinTransaction()
        Synchronise our active state with that of the JTA transaction, if it exists. Look for an active JTA transaction. If there is one, begin() ourselves and register synchronisation. We must poll because there is no way of getting notified of a newly begun transaction.
      • beforeCompletion

        public void beforeCompletion()
        Called by the transaction manager prior to the start of the two-phase transaction commit process.
        Specified by:
        beforeCompletion in interface javax.transaction.Synchronization
      • afterCompletion

        public void afterCompletion​(int status)
        Called by the transaction manager after the transaction is committed or rolled back. Must be synchronised because some callers expect to be owner of this object's monitor (internalPostCommit() calls closeSQLConnection() which calls notifyAll()).
        Specified by:
        afterCompletion in interface javax.transaction.Synchronization
        Parameters:
        status - The status