Class TransactionImpl

  • All Implemented Interfaces:
    javax.transaction.Transaction

    public class TransactionImpl
    extends java.lang.Object
    implements javax.transaction.Transaction
    Basic local transaction with support for multiple resources.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      org.apache.geronimo.transaction.manager.TransactionImpl.TransactionBranch addBranchXid​(javax.transaction.xa.XAResource xaRes, javax.transaction.xa.Xid branchId)  
      void commit()
      Complete the transaction represented by this Transaction object.
      boolean delistResource​(javax.transaction.xa.XAResource xaRes, int flag)
      Disassociate the resource specified from the transaction associated with the target Transaction object.
      boolean enlistResource​(javax.transaction.xa.XAResource xaRes)
      Enlist the resource specified with the transaction associated with the target Transaction object.
      boolean equals​(java.lang.Object obj)  
      java.lang.Object getResource​(java.lang.Object key)  
      boolean getRollbackOnly()  
      int getStatus()
      Obtain the status of the transaction associated with the target Transaction object.
      java.lang.Object getTransactionKey()  
      int getTransactionStatus()  
      void putResource​(java.lang.Object key, java.lang.Object value)  
      void registerInterposedSynchronization​(javax.transaction.Synchronization synchronization)  
      void registerSynchronization​(javax.transaction.Synchronization synch)
      Register a synchronization object for the transaction currently associated with the target object.
      void rollback()
      Rollback the transaction represented by this Transaction object.
      void setRollbackOnly()
      Modify the transaction associated with the target object such that the only possible outcome of the transaction is to roll back the transaction.
      void setRollbackOnly​(java.lang.Throwable reason)  
      • Methods inherited from class java.lang.Object

        getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • TransactionImpl

        public TransactionImpl​(javax.transaction.xa.Xid xid,
                               TransactionManagerImpl txManager)
    • Method Detail

      • getStatus

        public int getStatus()
        Description copied from interface: javax.transaction.Transaction
        Obtain the status of the transaction associated with the target Transaction object.
        Specified by:
        getStatus in interface javax.transaction.Transaction
        Returns:
        The transaction status. If no transaction is associated with the target object, this method returns the Status.NoTransaction value.
      • getResource

        public java.lang.Object getResource​(java.lang.Object key)
      • getRollbackOnly

        public boolean getRollbackOnly()
      • getTransactionKey

        public java.lang.Object getTransactionKey()
      • getTransactionStatus

        public int getTransactionStatus()
      • putResource

        public void putResource​(java.lang.Object key,
                                java.lang.Object value)
      • registerInterposedSynchronization

        public void registerInterposedSynchronization​(javax.transaction.Synchronization synchronization)
      • setRollbackOnly

        public void setRollbackOnly()
                             throws java.lang.IllegalStateException
        Description copied from interface: javax.transaction.Transaction
        Modify the transaction associated with the target object such that the only possible outcome of the transaction is to roll back the transaction.
        Specified by:
        setRollbackOnly in interface javax.transaction.Transaction
        Throws:
        java.lang.IllegalStateException - Thrown if the target object is not associated with any transaction.
      • setRollbackOnly

        public void setRollbackOnly​(java.lang.Throwable reason)
      • registerSynchronization

        public void registerSynchronization​(javax.transaction.Synchronization synch)
                                     throws java.lang.IllegalStateException,
                                            javax.transaction.RollbackException,
                                            javax.transaction.SystemException
        Description copied from interface: javax.transaction.Transaction
        Register a synchronization object for the transaction currently associated with the target object. The transction manager invokes the beforeCompletion method prior to starting the two-phase transaction commit process. After the transaction is completed, the transaction manager invokes the afterCompletion method.
        Specified by:
        registerSynchronization in interface javax.transaction.Transaction
        Parameters:
        synch - The Synchronization object for the transaction associated with the target object.
        Throws:
        java.lang.IllegalStateException - Thrown if the transaction in the target object is in the prepared state or the transaction is inactive.
        javax.transaction.RollbackException - Thrown to indicate that the transaction has been marked for rollback only.
        javax.transaction.SystemException - Thrown if the transaction manager encounters an unexpected error condition.
      • enlistResource

        public boolean enlistResource​(javax.transaction.xa.XAResource xaRes)
                               throws java.lang.IllegalStateException,
                                      javax.transaction.RollbackException,
                                      javax.transaction.SystemException
        Description copied from interface: javax.transaction.Transaction
        Enlist the resource specified with the transaction associated with the target Transaction object.
        Specified by:
        enlistResource in interface javax.transaction.Transaction
        Parameters:
        xaRes - The XAResource object associated with the resource (connection).
        Returns:
        true if the resource was enlisted successfully; otherwise false.
        Throws:
        java.lang.IllegalStateException - Thrown if the transaction in the target object is in the prepared state or the transaction is inactive.
        javax.transaction.RollbackException - Thrown to indicate that the transaction has been marked for rollback only.
        javax.transaction.SystemException - Thrown if the transaction manager encounters an unexpected error condition.
      • delistResource

        public boolean delistResource​(javax.transaction.xa.XAResource xaRes,
                                      int flag)
                               throws java.lang.IllegalStateException,
                                      javax.transaction.SystemException
        Description copied from interface: javax.transaction.Transaction
        Disassociate the resource specified from the transaction associated with the target Transaction object.
        Specified by:
        delistResource in interface javax.transaction.Transaction
        Parameters:
        xaRes - The XAResource object associated with the resource (connection).
        flag - One of the values of TMSUCCESS, TMSUSPEND, or TMFAIL.
        Returns:
        true if the resource was delisted successfully; otherwise false.
        Throws:
        java.lang.IllegalStateException - Thrown if the transaction in the target object is inactive.
        javax.transaction.SystemException - Thrown if the transaction manager encounters an unexpected error condition.
      • commit

        public void commit()
                    throws javax.transaction.HeuristicMixedException,
                           javax.transaction.HeuristicRollbackException,
                           javax.transaction.RollbackException,
                           java.lang.SecurityException,
                           javax.transaction.SystemException
        Description copied from interface: javax.transaction.Transaction
        Complete the transaction represented by this Transaction object.
        Specified by:
        commit in interface javax.transaction.Transaction
        Throws:
        javax.transaction.HeuristicMixedException - Thrown to indicate that a heuristic decision was made and that some relevant updates have been committed while others have been rolled back.
        javax.transaction.HeuristicRollbackException - Thrown to indicate that a heuristic decision was made and that all relevant updates have been rolled back.
        javax.transaction.RollbackException - Thrown to indicate that the transaction has been rolled back rather than committed.
        java.lang.SecurityException - Thrown to indicate that the thread is not allowed to commit the transaction.
        javax.transaction.SystemException - Thrown if the transaction manager encounters an unexpected error condition.
      • rollback

        public void rollback()
                      throws java.lang.IllegalStateException,
                             javax.transaction.SystemException
        Description copied from interface: javax.transaction.Transaction
        Rollback the transaction represented by this Transaction object.
        Specified by:
        rollback in interface javax.transaction.Transaction
        Throws:
        java.lang.IllegalStateException - Thrown if the transaction in the target object is in the prepared state or the transaction is inactive.
        javax.transaction.SystemException - Thrown if the transaction manager encounters an unexpected error condition.
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • addBranchXid

        public org.apache.geronimo.transaction.manager.TransactionImpl.TransactionBranch addBranchXid​(javax.transaction.xa.XAResource xaRes,
                                                                                                      javax.transaction.xa.Xid branchId)