Class BaseTransactionManagerDelegate

  • All Implemented Interfaces:
    javax.transaction.TransactionManager, org.jboss.tm.listener.TransactionListenerRegistry, org.jboss.tm.TransactionLocalDelegate, org.jboss.tm.TransactionTimeoutConfiguration
    Direct Known Subclasses:
    TransactionManagerDelegate, TransactionManagerDelegate

    public abstract class BaseTransactionManagerDelegate
    extends java.lang.Object
    implements javax.transaction.TransactionManager, org.jboss.tm.TransactionLocalDelegate, org.jboss.tm.TransactionTimeoutConfiguration, org.jboss.tm.listener.TransactionListenerRegistry
    Delegate for JBoss TransactionManager/TransactionLocalDelegate.
    Author:
    kevin
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected BaseTransactionManagerDelegate​(javax.transaction.TransactionManager transactionManager)
      Construct the delegate using the specified transaction manager.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addListener​(javax.transaction.Transaction transaction, org.jboss.tm.listener.TransactionListener listener, java.util.EnumSet<org.jboss.tm.listener.EventType> types)
      register a listener for transaction related events that effect the current thread
      void begin()
      Begin a transaction and associate it with the current thread.
      void commit()
      Commit the current transaction and disassociate from the thread.
      boolean containsValue​(org.jboss.tm.TransactionLocal transactionLocal, javax.transaction.Transaction transaction)
      Does the specified transaction contain a value for the transaction local.
      int getStatus()
      Get the transaction status.
      javax.transaction.Transaction getTransaction()
      Get the transaction associated with the thread.
      java.lang.Object getValue​(org.jboss.tm.TransactionLocal transactionLocal, javax.transaction.Transaction transaction)
      Get value of the transaction local in the specified transaction.
      void lock​(org.jboss.tm.TransactionLocal local, javax.transaction.Transaction transaction)
      Lock the transaction local in the context of this transaction.
      void resume​(javax.transaction.Transaction transaction)
      Resume the specified transaction.
      void rollback()
      Rollback the current transaction and disassociate from the thread.
      void setRollbackOnly()
      Set rollback only on the current transaction.
      void setTransactionTimeout​(int timeout)
      Set the transaction timeout on the current thread.
      void storeValue​(org.jboss.tm.TransactionLocal transactionLocal, javax.transaction.Transaction transaction, java.lang.Object value)
      Store the value of the transaction local in the specified transaction.
      javax.transaction.Transaction suspend()
      Suspend the current transaction.
      void unlock​(org.jboss.tm.TransactionLocal local, javax.transaction.Transaction transaction)
      Unlock the transaction local in the context of this transaction
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface org.jboss.tm.TransactionTimeoutConfiguration

        getTimeLeftBeforeTransactionTimeout, getTransactionTimeout
    • Constructor Detail

      • BaseTransactionManagerDelegate

        protected BaseTransactionManagerDelegate​(javax.transaction.TransactionManager transactionManager)
        Construct the delegate using the specified transaction manager.
        Parameters:
        transactionManager - The delegate transaction manager.
    • Method Detail

      • begin

        public void begin()
                   throws javax.transaction.NotSupportedException,
                          javax.transaction.SystemException
        Begin a transaction and associate it with the current thread.
        Specified by:
        begin in interface javax.transaction.TransactionManager
        Throws:
        javax.transaction.NotSupportedException
        javax.transaction.SystemException
      • commit

        public void commit()
                    throws javax.transaction.RollbackException,
                           javax.transaction.HeuristicMixedException,
                           javax.transaction.HeuristicRollbackException,
                           java.lang.SecurityException,
                           java.lang.IllegalStateException,
                           javax.transaction.SystemException
        Commit the current transaction and disassociate from the thread.
        Specified by:
        commit in interface javax.transaction.TransactionManager
        Throws:
        javax.transaction.RollbackException
        javax.transaction.HeuristicMixedException
        javax.transaction.HeuristicRollbackException
        java.lang.SecurityException
        java.lang.IllegalStateException
        javax.transaction.SystemException
      • getStatus

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

        public javax.transaction.Transaction getTransaction()
                                                     throws javax.transaction.SystemException
        Get the transaction associated with the thread.
        Specified by:
        getTransaction in interface javax.transaction.TransactionManager
        Returns:
        the transaction or null if none associated.
        Throws:
        javax.transaction.SystemException
      • resume

        public void resume​(javax.transaction.Transaction transaction)
                    throws javax.transaction.InvalidTransactionException,
                           java.lang.IllegalStateException,
                           javax.transaction.SystemException
        Resume the specified transaction.
        Specified by:
        resume in interface javax.transaction.TransactionManager
        Parameters:
        transaction - The transaction to resume.
        Throws:
        javax.transaction.InvalidTransactionException
        java.lang.IllegalStateException
        javax.transaction.SystemException
      • rollback

        public void rollback()
                      throws java.lang.IllegalStateException,
                             java.lang.SecurityException,
                             javax.transaction.SystemException
        Rollback the current transaction and disassociate from the thread.
        Specified by:
        rollback in interface javax.transaction.TransactionManager
        Throws:
        java.lang.IllegalStateException
        java.lang.SecurityException
        javax.transaction.SystemException
      • setRollbackOnly

        public void setRollbackOnly()
                             throws java.lang.IllegalStateException,
                                    javax.transaction.SystemException
        Set rollback only on the current transaction.
        Specified by:
        setRollbackOnly in interface javax.transaction.TransactionManager
        Throws:
        java.lang.IllegalStateException
        javax.transaction.SystemException
      • setTransactionTimeout

        public void setTransactionTimeout​(int timeout)
                                   throws javax.transaction.SystemException
        Set the transaction timeout on the current thread.
        Specified by:
        setTransactionTimeout in interface javax.transaction.TransactionManager
        Parameters:
        timeout - The transaction timeout.
        Throws:
        javax.transaction.SystemException
      • addListener

        public void addListener​(javax.transaction.Transaction transaction,
                                org.jboss.tm.listener.TransactionListener listener,
                                java.util.EnumSet<org.jboss.tm.listener.EventType> types)
                         throws org.jboss.tm.listener.TransactionTypeNotSupported
        register a listener for transaction related events that effect the current thread
        Specified by:
        addListener in interface org.jboss.tm.listener.TransactionListenerRegistry
        Parameters:
        listener - the callback for event notifications
        Throws:
        org.jboss.tm.listener.TransactionTypeNotSupported
      • suspend

        public javax.transaction.Transaction suspend()
                                              throws javax.transaction.SystemException
        Suspend the current transaction.
        Specified by:
        suspend in interface javax.transaction.TransactionManager
        Returns:
        The suspended transaction.
        Throws:
        javax.transaction.SystemException
      • containsValue

        public boolean containsValue​(org.jboss.tm.TransactionLocal transactionLocal,
                                     javax.transaction.Transaction transaction)
        Does the specified transaction contain a value for the transaction local.
        Specified by:
        containsValue in interface org.jboss.tm.TransactionLocalDelegate
        Parameters:
        transactionLocal - The associated transaction local.
        transaction - The associated transaction.
        Returns:
        true if a value exists within the specified transaction, false otherwise.
      • getValue

        public java.lang.Object getValue​(org.jboss.tm.TransactionLocal transactionLocal,
                                         javax.transaction.Transaction transaction)
        Get value of the transaction local in the specified transaction.
        Specified by:
        getValue in interface org.jboss.tm.TransactionLocalDelegate
        Parameters:
        transactionLocal - The associated transaction local.
        transaction - The associated transaction.
        Returns:
        The value of the transaction local.
      • storeValue

        public void storeValue​(org.jboss.tm.TransactionLocal transactionLocal,
                               javax.transaction.Transaction transaction,
                               java.lang.Object value)
        Store the value of the transaction local in the specified transaction.
        Specified by:
        storeValue in interface org.jboss.tm.TransactionLocalDelegate
        Parameters:
        transactionLocal - The associated transaction local.
        transaction - The associated transaction.
        value - The value of the transaction local.
      • lock

        public void lock​(org.jboss.tm.TransactionLocal local,
                         javax.transaction.Transaction transaction)
                  throws java.lang.InterruptedException
        Lock the transaction local in the context of this transaction.
        Specified by:
        lock in interface org.jboss.tm.TransactionLocalDelegate
        Throws:
        java.lang.IllegalStateException - if the transaction is not active
        java.lang.InterruptedException - if the thread is interrupted
      • unlock

        public void unlock​(org.jboss.tm.TransactionLocal local,
                           javax.transaction.Transaction transaction)
        Unlock the transaction local in the context of this transaction
        Specified by:
        unlock in interface org.jboss.tm.TransactionLocalDelegate