Class TransactionImple

java.lang.Object
com.arjuna.ats.internal.jta.transaction.jts.TransactionImple
All Implemented Interfaces:
Transaction, jakarta.transaction.Transaction
Direct Known Subclasses:
TransactionImple

public class TransactionImple extends Object implements jakarta.transaction.Transaction, Transaction
An implementation of jakarta.transaction.Transaction.
Since:
JTS 1.2.4.
Version:
$Id: TransactionImple.java 2342 2006-03-30 13:06:17Z $
Author:
Mark Little (mark_little@hp.com)
  • Field Details

  • Constructor Details

  • Method Details

    • equals

      public boolean equals(Object obj)
      Overloads Object.equals()
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      TransactionImple (which could be a proxy to the remote transaction) will return up to two different hashCodes. It will return a valid hashcode if the remote transaction is active and it will return -1 if the transaction is no longer active. The hashcode is the uid of the transaction, when the transaction completes it no longer has a uid in theory hence the -1. With raw JTA as we don't reset the uid when the transaction completes it will still get a hashcode based off the uid. Return -1 if we fail.
      Overrides:
      hashCode in class Object
    • getControlWrapper

      public com.arjuna.ats.internal.jts.ControlWrapper getControlWrapper()
    • commit

      public void commit() throws jakarta.transaction.RollbackException, jakarta.transaction.HeuristicMixedException, jakarta.transaction.HeuristicRollbackException, SecurityException, jakarta.transaction.SystemException, IllegalStateException
      We will never throw a HeuristicRollbackException because if we get a HeuristicRollback from a resource, and can successfully rollback the other resources, this is then the same as having simply been forced to rollback the transaction during phase 1. The OTS interfaces do not allow a differentiation.
      Specified by:
      commit in interface jakarta.transaction.Transaction
      Throws:
      jakarta.transaction.RollbackException
      jakarta.transaction.HeuristicMixedException
      jakarta.transaction.HeuristicRollbackException
      SecurityException
      jakarta.transaction.SystemException
      IllegalStateException
    • rollback

      public void rollback() throws IllegalStateException, SecurityException, jakarta.transaction.SystemException
      Specified by:
      rollback in interface jakarta.transaction.Transaction
      Throws:
      IllegalStateException
      SecurityException
      jakarta.transaction.SystemException
    • setRollbackOnly

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

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

      public void registerSynchronization(jakarta.transaction.Synchronization sync) throws jakarta.transaction.RollbackException, IllegalStateException, jakarta.transaction.SystemException
      Specified by:
      registerSynchronization in interface jakarta.transaction.Transaction
      Throws:
      jakarta.transaction.RollbackException
      IllegalStateException
      jakarta.transaction.SystemException
    • enlistResource

      public boolean enlistResource(XAResource xaRes) throws jakarta.transaction.RollbackException, IllegalStateException, jakarta.transaction.SystemException
      Specified by:
      enlistResource in interface jakarta.transaction.Transaction
      Throws:
      jakarta.transaction.RollbackException
      IllegalStateException
      jakarta.transaction.SystemException
    • enlistResource

      public boolean enlistResource(XAResource xaRes, Object[] params) throws jakarta.transaction.RollbackException, IllegalStateException, jakarta.transaction.SystemException
      Specified by:
      enlistResource in interface Transaction
      Throws:
      jakarta.transaction.RollbackException
      IllegalStateException
      jakarta.transaction.SystemException
    • delistResource

      public boolean delistResource(XAResource xaRes, int flags) throws IllegalStateException, jakarta.transaction.SystemException
      Specified by:
      delistResource in interface jakarta.transaction.Transaction
      Throws:
      IllegalStateException
      jakarta.transaction.SystemException
    • get_uid

      public final Uid get_uid()
      Specified by:
      get_uid in interface Transaction
    • getTxId

      public final Xid getTxId()
      Specified by:
      getTxId in interface Transaction
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • endAssociation

      public void endAssociation(Xid _tranID, XAResource _theXAResource, int xaState, int txInfoState) throws XAException
      Throws:
      XAException
    • getXAResourceState

      public int getXAResourceState(XAResource xaRes)
      Specified by:
      getXAResourceState in interface Transaction
    • setXAResourceState

      public void setXAResourceState(XAResource xaRes, int state)
    • getTransaction

      public static final TransactionImple getTransaction()
      Creates if does not exist and adds to our internal mapping table.
    • getTransaction

      public static final TransactionImple getTransaction(Uid id)
    • shutdown

      public final void shutdown()
    • getTxLocalResource

      public Object getTxLocalResource(Object key)
      Specified by:
      getTxLocalResource in interface Transaction
    • putTxLocalResource

      public void putTxLocalResource(Object key, Object value)
      Specified by:
      putTxLocalResource in interface Transaction
    • isAlive

      public boolean isAlive()
      Specified by:
      isAlive in interface Transaction
    • commitAndDisassociate

      protected void commitAndDisassociate() throws jakarta.transaction.RollbackException, jakarta.transaction.HeuristicMixedException, jakarta.transaction.HeuristicRollbackException, SecurityException, jakarta.transaction.SystemException, IllegalStateException
      Throws:
      jakarta.transaction.RollbackException
      jakarta.transaction.HeuristicMixedException
      jakarta.transaction.HeuristicRollbackException
      SecurityException
      jakarta.transaction.SystemException
      IllegalStateException
    • rollbackAndDisassociate

      protected void rollbackAndDisassociate() throws IllegalStateException, SecurityException, jakarta.transaction.SystemException
      Throws:
      IllegalStateException
      SecurityException
      jakarta.transaction.SystemException
    • baseXid

      protected Xid baseXid()
      If this is an imported JCA transaction, then this method will return the Xid we should pretend to be. Otherwise it'll return null and we will generate our own Xid.
      Returns:
      null for a pure ATS transaction, otherwise a valid JCA imported Xid.
    • putTransaction

      protected static final void putTransaction(TransactionImple tx)
    • removeTransaction

      public static final void removeTransaction(TransactionImple tx)
    • endSuspendedRMs

      protected boolean endSuspendedRMs()
      If there are any suspended RMs then we should call end on them before the transaction is terminated.
    • getTransactions

      public static Map<Uid,jakarta.transaction.Transaction> getTransactions()
    • getResources

      public Map<XAResource,TxInfo> getResources()
      Specified by:
      getResources in interface Transaction
    • getTimeout

      public int getTimeout()
      Specified by:
      getTimeout in interface Transaction
    • getRemainingTimeoutMills

      public long getRemainingTimeoutMills()
      Specified by:
      getRemainingTimeoutMills in interface Transaction
    • getSynchronizations

      public Map<Uid,String> getSynchronizations()
      Specified by:
      getSynchronizations in interface Transaction