Class XAResourceRecord

java.lang.Object
com.arjuna.ats.arjuna.StateManager
com.arjuna.ats.arjuna.coordinator.AbstractRecord
com.arjuna.ats.internal.jta.resources.arjunacore.XAResourceRecord
All Implemented Interfaces:
ExceptionDeferrer
Direct Known Subclasses:
XARecoveryResourceImple

public class XAResourceRecord extends AbstractRecord implements ExceptionDeferrer
Since:
JTS 1.2.4.
Version:
$Id: XAResourceRecord.java 2342 2006-03-30 13:06:17Z $
Author:
Mark Little (mark_little@hp.com)
  • Field Details

  • Constructor Details

    • XAResourceRecord

      public XAResourceRecord()
    • XAResourceRecord

      public XAResourceRecord(Uid u)
    • XAResourceRecord

      public XAResourceRecord(TransactionImple tx, XAResource res, Xid xid, Object[] params)
      The params represent specific parameters we need to recreate the connection to the database in the event of a failure. If they're not set then recovery is out of our control.

      Could also use it to pass other information, such as the readonly flag.

  • Method Details

    • getXid

      public final Xid getXid()
    • order

      public Uid order()
      Description copied from class: AbstractRecord
      Return the Uid of this abstract record so that it can be ordered in the intentions list. This is also the Uid that the record was saved with in the object store.
      Overrides:
      order in class AbstractRecord
      Returns:
      Uid for this instance.
      See Also:
    • propagateOnCommit

      public boolean propagateOnCommit()
      Description copied from class: AbstractRecord
      Determine if records are discarded on action commit or must be propagated to parents.
      Overrides:
      propagateOnCommit in class AbstractRecord
      Returns:
      true if the record should be propagated to the parent transaction if the current transaction commits, false otherwise. The default is true.
    • typeIs

      public int typeIs()
      Specified by:
      typeIs in class AbstractRecord
      Returns:
      RecordType value.
    • value

      public Object value()
      Description copied from class: AbstractRecord
      If this abstract record caused a heuristic then it should return an object which implements HeuristicInformation
      Specified by:
      value in class AbstractRecord
      Returns:
      Object to be used to order.
    • setValue

      public void setValue(Object o)
      Specified by:
      setValue in class AbstractRecord
    • nestedAbort

      public int nestedAbort()
      Description copied from class: AbstractRecord
      A rollback of a nested transaction has occurred.
      Specified by:
      nestedAbort in class AbstractRecord
      Returns:
      TwoPhaseOutcome to indicate success/failure.
      See Also:
    • nestedCommit

      public int nestedCommit()
      Description copied from class: AbstractRecord
      A commit of a nested transaction has occurred.
      Specified by:
      nestedCommit in class AbstractRecord
      Returns:
      TwoPhaseOutcome to indicate success/failure.
      See Also:
    • nestedPrepare

      public int nestedPrepare()
      Description copied from class: AbstractRecord
      A prepare for a nested transaction has occurred.
      Specified by:
      nestedPrepare in class AbstractRecord
      Returns:
      TwoPhaseOutcome to indicate success/failure.
      See Also:
    • topLevelPrepare

      public int topLevelPrepare()
      Description copied from class: AbstractRecord
      A prepare for a top-level transaction has occurred.
      Specified by:
      topLevelPrepare in class AbstractRecord
      Returns:
      TwoPhaseOutcome to indicate success/failure.
      See Also:
    • topLevelAbort

      public int topLevelAbort()
      Description copied from class: AbstractRecord
      A rollback of a top-level transaction has occurred.
      Specified by:
      topLevelAbort in class AbstractRecord
      Returns:
      TwoPhaseOutcome to indicate success/failure.
      See Also:
    • topLevelCommit

      public int topLevelCommit()
      Description copied from class: AbstractRecord
      A commit of a top-level transaction has occurred.
      Specified by:
      topLevelCommit in class AbstractRecord
      Returns:
      TwoPhaseOutcome to indicate success/failure.
      See Also:
    • notAProblem

      protected boolean notAProblem(XAException ex, boolean commit)
      Is the XAException a non-error when received in reply to commit or rollback ? It normally is, but may be overridden in recovery.
    • nestedOnePhaseCommit

      public int nestedOnePhaseCommit()
      Description copied from class: AbstractRecord
      Perform a nested one phase commit.
      Overrides:
      nestedOnePhaseCommit in class AbstractRecord
      Returns:
      TwoPhaseOutcome to indicate success/failure.
      See Also:
    • topLevelOnePhaseCommit

      public int topLevelOnePhaseCommit()
      For commit_one_phase we can do whatever we want since the transaction outcome is whatever we want. Therefore, we do not need to save any additional recoverable state, such as a reference to the transaction coordinator, since it will not have an intentions list anyway.
      Overrides:
      topLevelOnePhaseCommit in class AbstractRecord
      Returns:
      TwoPhaseOutcome to indicate success/failure.
      See Also:
    • clearHeuristicDecision

      public void clearHeuristicDecision()
      Description copied from class: AbstractRecord
      Clearing the heuristic state on the resource. If the resource maintains a state of the prior heuristic outcome then it should use this method to clear the state and forget the heuristic.
      Overrides:
      clearHeuristicDecision in class AbstractRecord
    • forgetHeuristic

      public boolean forgetHeuristic()
      Description copied from class: AbstractRecord
      Forget any heuristic outcome which this implementation may have produced.
      Overrides:
      forgetHeuristic in class AbstractRecord
      Returns:
      true by default. If false is returned then the instance must be remembered by the transaction (in the log) in order for recovery to retry later or for a system administrator to be able to determine which resources have not been successfully completed.
    • recover

      protected int recover()
      Independant recovery cannot occur. Must be driven by the recovery of the local transaction, i.e., top-down recovery.
    • save_state

      public boolean save_state(OutputObjectState os, int t)
      Description copied from class: AbstractRecord
      When the transaction is required to make the intentions list persistent, it scans the list and asks each record whether or not it requires state to be saved (by calling doSave). If the answer is yes, then save_state is called and the record instance must save enough information to enable it to be restored from that state later. The basic AbstractRecord save_state will save common data that is required by the base class during recovery. If a derived class calls super.save_state then it must be called before packing any other data item.
      Overrides:
      save_state in class AbstractRecord
      Returns:
      true if successful, false otherwise.
    • restore_state

      public boolean restore_state(InputObjectState os, int t)
      Description copied from class: AbstractRecord
      During recovery, the transaction log is given to the recovery system and it will recreate a transaction instance to perform necessary recovery actions. This transaction will recreate the intentions list and give each recreated AbstractRecord the state that that was saved during transaction persistence. The base class will restore information that it needs from the log. Data items must be unpacked in the same order that they were packed.
      Overrides:
      restore_state in class AbstractRecord
      Returns:
      true if successful, false otherwise.
    • type

      public String type()
      Description copied from class: AbstractRecord
      Re-implementation of abstract methods inherited from base class.
      Overrides:
      type in class AbstractRecord
    • typeName

      public static String typeName()
    • doSave

      public boolean doSave()
      Description copied from class: AbstractRecord
      Should this record be saved in the intentions list? If the record is saved, then it may be recovered later in the event of a failure. Note, however, that the size of the intentions list on disk is critical to the performance of the system (disk I/O is a bottleneck).
      Overrides:
      doSave in class AbstractRecord
      Returns:
      true if it should be saved, false otherwise. false is the default.
    • merge

      public void merge(AbstractRecord a)
      Description copied from class: AbstractRecord
      Merge the current record with the one presented.
      Specified by:
      merge in class AbstractRecord
      Parameters:
      a - the record with which to merge.
    • alter

      public void alter(AbstractRecord a)
      Description copied from class: AbstractRecord
      Alter the current record with the one presented.
      Specified by:
      alter in class AbstractRecord
      Parameters:
      a - the record with which to alter.
    • shouldAdd

      public boolean shouldAdd(AbstractRecord a)
      Description copied from class: AbstractRecord
      Should we add the record presented to the intentions list?
      Specified by:
      shouldAdd in class AbstractRecord
      Parameters:
      a - The record to try to add.
      Returns:
      true if the record should be added, false otherwise.
    • shouldAlter

      public boolean shouldAlter(AbstractRecord a)
      Description copied from class: AbstractRecord
      Should we alter the current record with the one presented?
      Specified by:
      shouldAlter in class AbstractRecord
      Parameters:
      a - The record to try to alter.
      Returns:
      true if the record should be altered, false otherwise.
    • shouldMerge

      public boolean shouldMerge(AbstractRecord a)
      Description copied from class: AbstractRecord
      Should we merge the current record with the one presented?
      Specified by:
      shouldMerge in class AbstractRecord
      Parameters:
      a - The record to try to merge.
      Returns:
      true if the record should be merged, false otherwise.
    • shouldReplace

      public boolean shouldReplace(AbstractRecord a)
      Description copied from class: AbstractRecord
      Should we replace the record presented with the current record?
      Specified by:
      shouldReplace in class AbstractRecord
      Parameters:
      a - The record to try to replace.
      Returns:
      true if the record should be replaced, false otherwise.
    • getProductName

      public String getProductName()
      Returns the resource manager product name.
      Returns:
      the product name
    • setProductName

      public void setProductName(String productName)
      Sets the resource manager product name.
      Parameters:
      productName - the product name
    • getProductVersion

      public String getProductVersion()
      Returns the resource manager product version.
      Returns:
      the product version
    • setProductVersion

      public void setProductVersion(String productVersion)
      Sets the resource manager product version.
      Parameters:
      productVersion - the product version
    • getJndiName

      public String getJndiName()
      Returns the resource manager JNDI name for e.g. xa datasource. Note this is not used for lookup, only for information.
      Returns:
      the JNDI name.
    • setJndiName

      public void setJndiName(String jndiName)
      Sets the resource manager JNDI name. Note this is not used for lookup, only for information.
      Parameters:
      jndiName - the JNDI name.
    • toString

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

      public int getHeuristic()
    • isForgotten

      public boolean isForgotten()
    • getDeferredThrowables

      public void getDeferredThrowables(List<Throwable> list)
      Description copied from interface: ExceptionDeferrer
      Adds all supressed throwables of this ExceptionDeferrer to the given list in order of appearance.
      Specified by:
      getDeferredThrowables in interface ExceptionDeferrer
      Parameters:
      list -