All Implemented Interfaces:
ArjunaTransactionOperations, UidCoordinatorOperations, Reapable, CoordinatorOperations, TerminatorOperations
Direct Known Subclasses:
RecoveredServerTransaction, ServerTransaction, ServerTransactionWrapper

public class ServerTransaction extends ArjunaTransactionImple
This looks like an Transaction, but is only created for interposition purposes. The classes ServerTopLevelAction and ServerNestedAction use instances of this class to drive the server-side protocol.
Since:
JTS 1.0.
Version:
$Id: ServerTransaction.java 2342 2006-03-30 13:06:17Z $
Author:
Mark Little (mark@arjuna.com)
  • Field Details

  • Constructor Details

    • ServerTransaction

      public ServerTransaction(Uid actUid, Control myParent)
    • ServerTransaction

      public ServerTransaction(Uid actUid, Control myParent, ArjunaTransactionImple parentImpl)
    • ServerTransaction

      protected ServerTransaction(Uid recoveringActUid)
      Used during crash recovery. The Uid is the identity of the state which this transaction's log is stored in. It is not the identity of the transaction! Therefore you may pass nullUid to the base transaction and rely on activating the transaction state to set up the transaction id.
  • Method Details

    • finalize

      public void finalize()
      Overrides:
      finalize in class ArjunaTransactionImple
    • type

      public String type()
      Description copied from class: TwoPhaseCoordinator
      Overloads BasicAction.type()
      Overrides:
      type in class ArjunaTransactionImple
    • getSavingUid

      public Uid getSavingUid()
      Overrides:
      getSavingUid in class BasicAction
      Returns:
      the Uid that the transaction's intentions list will be saved under.
    • doPrepare

      public final int doPrepare()
    • doForget

      public final void doForget()
    • doPhase2Commit

      public final int doPhase2Commit()
    • doPhase2Abort

      public final int doPhase2Abort()
    • doCommit

      public void doCommit(boolean report_heuristics) throws HeuristicHazard, org.omg.CORBA.SystemException
      Throws:
      HeuristicHazard
      org.omg.CORBA.SystemException
    • rollback

      public void rollback() throws org.omg.CORBA.SystemException
      Specified by:
      rollback in interface TerminatorOperations
      Overrides:
      rollback in class ArjunaTransactionImple
      Throws:
      org.omg.CORBA.SystemException
    • register_synchronization

      public void register_synchronization(Synchronization theSync) throws Inactive, SynchronizationUnavailable, org.omg.CORBA.SystemException
      Registering a synchronization with interposition is a bit complicated! Synchronizations must be called prior to prepare; if no interposed-synchronization is used then either synchronizations would be registered locally (and then ignored by the commit protocol) or they would need to be registered remotely, which would mean a cross-address space call for each synchronization! The first time a synchronization is registered locally, we register a proxy back with the real coordinator. When that transaction commits, it will call this proxy, which will then drive the locally registered synchronizations (actually it calls appropriate on the transaction to do this.) However, one-phase commit complicates matters even more since we call commit on the interposed coordinator, which runs through the commit and then the after_completion code before returning to the real coordinator's commit call. Rather than separate commit and synchronization code completely from the transaction (in which case we could just call the commit portion here) we let after_completion get called before returning the commit response, and simply ignore the real coordinator's subsequent call to after_completion.
      Specified by:
      register_synchronization in interface CoordinatorOperations
      Overrides:
      register_synchronization in class ArjunaTransactionImple
      Throws:
      Inactive
      SynchronizationUnavailable
      org.omg.CORBA.SystemException
    • doBeforeCompletion

      public void doBeforeCompletion() throws org.omg.CORBA.SystemException
      Overrides:
      doBeforeCompletion in class ArjunaTransactionImple
      Throws:
      org.omg.CORBA.SystemException
    • doAfterCompletion

      public void doAfterCompletion(Status s) throws org.omg.CORBA.SystemException
      Overrides:
      doAfterCompletion in class ArjunaTransactionImple
      Throws:
      org.omg.CORBA.SystemException
    • typeName

      public static String typeName()
    • setRecoveryCoordinator

      public final void setRecoveryCoordinator(RecoveryCoordinator recCoord)
    • save_state

      public boolean save_state(OutputObjectState os, 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 BasicAction
      Returns:
      true if successful, false otherwise.
    • restore_state

      public boolean restore_state(InputObjectState os, int ot)
      Description copied from class: BasicAction
      This assumes the various lists are zero length when it is called.
      Overrides:
      restore_state in class BasicAction
      Returns:
      true if successful, false otherwise.
    • toString

      public String toString()
      Description copied from class: BasicAction
      Overloads Object.toString()
      Overrides:
      toString in class ArjunaTransactionImple
    • preparedStatus

      protected final int preparedStatus()
      Overrides:
      preparedStatus in class BasicAction
      Returns:
      the transaction's prepared status.