Class TransactionManagerHelper

  • All Implemented Interfaces:
    TransactionImport, jakarta.transaction.TransactionManager

    @Service
    @ContractsProvided({TransactionManagerHelper.class,jakarta.transaction.TransactionManager.class})
    public class TransactionManagerHelper
    extends Object
    implements jakarta.transaction.TransactionManager, TransactionImport
    This class is wrapper for the actual transaction manager implementation. JNDI lookup name "java:appserver/TransactionManager" see the com/sun/enterprise/naming/java/javaURLContext.java
    • Constructor Detail

      • TransactionManagerHelper

        public TransactionManagerHelper()
    • Method Detail

      • begin

        public void begin()
                   throws jakarta.transaction.NotSupportedException,
                          jakarta.transaction.SystemException
        Specified by:
        begin in interface jakarta.transaction.TransactionManager
        Throws:
        jakarta.transaction.NotSupportedException
        jakarta.transaction.SystemException
      • commit

        public void commit()
                    throws jakarta.transaction.RollbackException,
                           jakarta.transaction.HeuristicMixedException,
                           jakarta.transaction.HeuristicRollbackException,
                           SecurityException,
                           IllegalStateException,
                           jakarta.transaction.SystemException
        Specified by:
        commit in interface jakarta.transaction.TransactionManager
        Throws:
        jakarta.transaction.RollbackException
        jakarta.transaction.HeuristicMixedException
        jakarta.transaction.HeuristicRollbackException
        SecurityException
        IllegalStateException
        jakarta.transaction.SystemException
      • getStatus

        public int getStatus()
                      throws jakarta.transaction.SystemException
        Specified by:
        getStatus in interface jakarta.transaction.TransactionManager
        Throws:
        jakarta.transaction.SystemException
      • getTransaction

        public jakarta.transaction.Transaction getTransaction()
                                                       throws jakarta.transaction.SystemException
        Specified by:
        getTransaction in interface jakarta.transaction.TransactionManager
        Throws:
        jakarta.transaction.SystemException
      • resume

        public void resume​(jakarta.transaction.Transaction tobj)
                    throws jakarta.transaction.InvalidTransactionException,
                           IllegalStateException,
                           jakarta.transaction.SystemException
        Specified by:
        resume in interface jakarta.transaction.TransactionManager
        Throws:
        jakarta.transaction.InvalidTransactionException
        IllegalStateException
        jakarta.transaction.SystemException
      • setRollbackOnly

        public void setRollbackOnly()
                             throws IllegalStateException,
                                    jakarta.transaction.SystemException
        Specified by:
        setRollbackOnly in interface jakarta.transaction.TransactionManager
        Throws:
        IllegalStateException
        jakarta.transaction.SystemException
      • setTransactionTimeout

        public void setTransactionTimeout​(int seconds)
                                   throws jakarta.transaction.SystemException
        Specified by:
        setTransactionTimeout in interface jakarta.transaction.TransactionManager
        Throws:
        jakarta.transaction.SystemException
      • suspend

        public jakarta.transaction.Transaction suspend()
                                                throws jakarta.transaction.SystemException
        Specified by:
        suspend in interface jakarta.transaction.TransactionManager
        Throws:
        jakarta.transaction.SystemException
      • recreate

        public void recreate​(Xid xid,
                             long timeout)
        Description copied from interface: TransactionImport
        Recreate a transaction based on the Xid. This call causes the calling thread to be associated with the specified transaction.

        This method imports a transactional context controlled by an external transaction manager.

        Specified by:
        recreate in interface TransactionImport
        Parameters:
        xid - the Xid object representing a transaction.
      • release

        public void release​(Xid xid)
        Description copied from interface: TransactionImport
        Release a transaction. This call causes the calling thread to be dissociated from the specified transaction.

        This call releases transactional context imported by recreate method.

        Specified by:
        release in interface TransactionImport
        Parameters:
        xid - the Xid object representing a transaction.
      • getXATerminator

        public jakarta.resource.spi.XATerminator getXATerminator()
        Description copied from interface: TransactionImport
        Provides a handle to a XATerminator instance.

        The XATerminator exports 2PC protocol control to an external root transaction coordinator.

        Specified by:
        getXATerminator in interface TransactionImport
        Returns:
        a XATerminator instance.
      • preInvokeTx

        public void preInvokeTx​(boolean checkServletInvocation)
        PreInvoke Transaction configuration for Servlet Container. BaseContainer.preInvokeTx() handles all this for CMT EJB. Compensate that JavaEEInstanceListener.handleBeforeEvent( BEFORE_SERVICE_EVENT) gets called before WSIT WSTX Service pipe associates a JTA txn with incoming thread. Precondition: assumes JTA transaction already associated with current thread.
      • postInvokeTx

        public void postInvokeTx​(boolean suspend,
                                 boolean checkServletInvocation)
        PostInvoke Transaction configuration for Servlet Container. BaseContainer.preInvokeTx() handles all this for CMT EJB. Precondition: assumed called prior to current transcation being suspended or released.
        Parameters:
        suspend - indicate whether the delisting is due to suspension or transaction completion(commmit/rollback)
      • getTransactionRemainingTimeout

        public int getTransactionRemainingTimeout()
                                           throws jakarta.transaction.SystemException
        Return duration before current transaction would timeout.
        Specified by:
        getTransactionRemainingTimeout in interface TransactionImport
        Returns:
        Returns the duration in seconds before current transaction would timeout. Returns zero if transaction has no timeout set and returns negative value if transaction already timed out.
        Throws:
        IllegalStateException - Thrown if the current thread is not associated with a transaction.
        jakarta.transaction.SystemException - Thrown if the transaction manager encounters an unexpected error condition.
      • registerRecoveryResourceHandler

        public void registerRecoveryResourceHandler​(XAResource xaResource)
        Allows an arbitrary XAResource to register for recovery
        Specified by:
        registerRecoveryResourceHandler in interface TransactionImport
        Parameters:
        xaResource - XAResource to register for recovery