Class RecoveredServerTransaction

All Implemented Interfaces:
ArjunaTransactionOperations, UidCoordinatorOperations, Reapable, RecoveringTransaction, CoordinatorOperations, TerminatorOperations
Direct Known Subclasses:
AssumedCompleteHeuristicServerTransaction, AssumedCompleteServerTransaction

public class RecoveredServerTransaction extends ServerTransaction implements RecoveringTransaction
Transaction type only instantiated at recovery time. This is used to re-activate the state of a server transaction that did not terminate correctly due to failure.

Version:
$Id: RecoveredServerTransaction.java 2342 2006-03-30 13:06:17Z $
Author:
Dave Ingham (dave@arjuna.com)
  • Field Details

    • _originalProcessUid

      protected Uid _originalProcessUid
  • Constructor Details

    • RecoveredServerTransaction

      public RecoveredServerTransaction(Uid actionUid)
      actionUid is the local transaction identification for the remote transaction - the name of the store entry which contains the state of the server transaction. The actual main transaction id is only obtained when we activate the transaction.
    • RecoveredServerTransaction

      public RecoveredServerTransaction(Uid actionUid, String changedTypeName)
      actionUid is the local transaction identification for the remote transaction - the name of the store entry which contains the state of the server transaction. The actual main transaction id is only obtained when we activate the transaction.
  • Method Details

    • get_status

      public Status get_status() throws org.omg.CORBA.SystemException
      Get the status of the transaction. If we successfully activated the transaction then we return whatever the transaction reports otherwise we return RolledBack as we're using presumed abort.
      Specified by:
      get_status in interface CoordinatorOperations
      Specified by:
      get_status in interface RecoveringTransaction
      Overrides:
      get_status in class ArjunaTransactionImple
      Throws:
      org.omg.CORBA.SystemException
    • addResourceRecord

      public void addResourceRecord(Uid rcUid, Resource r)
      Allows a new Resource to be added to the transaction. Typically this is used to replace a Resource that has failed and cannot be recovered on it's original IOR.
      Specified by:
      addResourceRecord in interface RecoveringTransaction
    • replayPhase2

      public void replayPhase2()
      Causes phase 2 of the commit protocol to be replayed.
      Specified by:
      replayPhase2 in interface RecoveringTransaction
    • getRecoveryStatus

      public int getRecoveryStatus()
      Get the status of recovery for this transaction
      Specified by:
      getRecoveryStatus in interface RecoveringTransaction
    • getOriginalStatus

      public Status getOriginalStatus()
      Check the status of this transaction state, i.e., that represented by get_uid and not getSavingUid
      Specified by:
      getOriginalStatus in interface RecoveringTransaction
    • allCompleted

      public boolean allCompleted()
      Specified by:
      allCompleted in interface RecoveringTransaction
    • type

      public String type()
      Description copied from class: TwoPhaseCoordinator
      Overloads BasicAction.type()
      Specified by:
      type in interface RecoveringTransaction
      Overrides:
      type in class ServerTransaction
    • removeOldStoreEntry

      public void removeOldStoreEntry()
      Specified by:
      removeOldStoreEntry in interface RecoveringTransaction
    • assumeComplete

      public boolean assumeComplete()
      Description copied from interface: RecoveringTransaction
      Tell transaction it is assumed to be complete and should convert itself to the appropriate assumed complete type.
      Specified by:
      assumeComplete in interface RecoveringTransaction
    • packHeader

      protected void packHeader(OutputObjectState os, com.arjuna.ats.internal.arjuna.Header hdr) throws IOException
      Override StateManager packHeader so it gets the original processUid, not this process's
      Overrides:
      packHeader in class StateManager
      Throws:
      IOException
      Since:
      JTS 2.1.
    • unpackHeader

      protected void unpackHeader(InputObjectState os, com.arjuna.ats.internal.arjuna.Header hdr) throws IOException
      Override StateManager's unpackHeader to save the processUid of the original process
      Overrides:
      unpackHeader in class StateManager
      Parameters:
      os - the identity of the transaction that last caused the state to be written to the object store.
      Throws:
      IOException
      Since:
      JTS 2.1.
    • save_state

      public boolean save_state(OutputObjectState objectState, int ot)
      Description copied from class: BasicAction
      Redefined version of save_state and restore_state from StateManager. Normal operation (no crashes): BasicAction.save_state is called after a successful prepare. This causes and BasicAction object to be saved in the object store. This object contains primarily the "intentions list" of the BasicAction. After successfully completing phase 2 of the commit protocol, the BasicAction object is deleted from the store. Failure cases: If a server crashes after successfully preparing, then upon recovery the action must be resolved (either committed or aborted) depending upon whether the co-ordinating atomic action committed or aborted. Upon server recovery, the crash recovery mechanism detects ServerBasicAction objects in the object store and attempts to activate the BasicAction object of the co-ordinating action. If this is successful then the SAA is committed else aborted. If, when processing phase 2 of the commit protocol, the co-ordinator experiences a failure to commit from one of the records then the BasicAction object is NOT deleted. It is rewritten when a new state which contains a list of the records that failed during phase 2 commit. This list is called the "failedList". The crash recovery manager will detect local BasicAction objects in addition to SAA objects in the objectstore. An attempt will be made to commit these actions. If the action contained a call to a now dead server, this action can never be resolved and the AA object can never be removed. However, if the action is purely local then after the processing is complete the removed by crash recovery.
      Overrides:
      save_state in class ServerTransaction
      Returns:
      true if successful, false otherwise.
    • getLastActiveTime

      public Date getLastActiveTime()
      do not admit to being inactive
      Specified by:
      getLastActiveTime in interface RecoveringTransaction