Class CDIDelegatingTransactionManager

  • All Implemented Interfaces:
    Serializable, javax.transaction.TransactionManager

    @Singleton
    public class CDIDelegatingTransactionManager
    extends Object
    implements javax.transaction.TransactionManager, Serializable
    A delegating transaction manager which receives an instance of Narayana transaction manager and delegates all calls to it. On top of it the implementation adds the CDI events processing for TransactionScoped.
    See Also:
    Serialized Form
    • Field Detail

      • transactionScopeInitialized

        @Inject
        @Initialized(javax.transaction.TransactionScoped.class)
        javax.enterprise.event.Event<javax.transaction.Transaction> transactionScopeInitialized
        An Event that can fire Transactions when the transaction scope is initialized.
      • transactionScopeBeforeDestroyed

        @Inject
        @BeforeDestroyed(javax.transaction.TransactionScoped.class)
        javax.enterprise.event.Event<Object> transactionScopeBeforeDestroyed
        An Event that can fire Objects before the transaction scope is destroyed.
      • transactionScopeDestroyed

        @Inject
        @Destroyed(javax.transaction.TransactionScoped.class)
        javax.enterprise.event.Event<Object> transactionScopeDestroyed
        An Event that can fire Objects when the transaction scope is destroyed.
    • Constructor Detail

      • CDIDelegatingTransactionManager

        public CDIDelegatingTransactionManager()
        Delegating transaction manager call to com.arjuna.ats.jta.TransactionManager
    • Method Detail

      • begin

        public void begin()
                   throws javax.transaction.NotSupportedException,
                          javax.transaction.SystemException
        Overrides TransactionManager.begin() to additionally fire an Object representing the initialization of the transaction scope.
        Specified by:
        begin in interface javax.transaction.TransactionManager
        Throws:
        javax.transaction.NotSupportedException
        javax.transaction.SystemException
        See Also:
        TransactionManager.begin()
      • commit

        public void commit()
                    throws javax.transaction.RollbackException,
                           javax.transaction.HeuristicMixedException,
                           javax.transaction.HeuristicRollbackException,
                           SecurityException,
                           IllegalStateException,
                           javax.transaction.SystemException
        Overrides TransactionManager.commit() to additionally fire an Object representing the before destruction and the destruction of the transaction scope.
        Specified by:
        commit in interface javax.transaction.TransactionManager
        Throws:
        javax.transaction.RollbackException
        javax.transaction.HeuristicMixedException
        javax.transaction.HeuristicRollbackException
        SecurityException
        IllegalStateException
        javax.transaction.SystemException
        See Also:
        TransactionManager.commit()
      • rollback

        public void rollback()
                      throws IllegalStateException,
                             SecurityException,
                             javax.transaction.SystemException
        Overrides TransactionManager.rollback() to additionally fire an Object representing the before destruction and the destruction of the transaction scope.
        Specified by:
        rollback in interface javax.transaction.TransactionManager
        Throws:
        IllegalStateException
        SecurityException
        javax.transaction.SystemException
        See Also:
        TransactionManager.rollback()
      • getStatus

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

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

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

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

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

        public int getTransactionTimeout()
                                  throws javax.transaction.SystemException
        Returns transaction timeout in seconds.
        Returns:
        transaction timeout set currently
        Throws:
        javax.transaction.SystemException - on an undefined error
      • suspend

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