Class TwoPhaseCoordinator

All Implemented Interfaces:
Reapable
Direct Known Subclasses:
ArjunaTransactionImple, com.arjuna.mwlabs.wscf.model.twophase.arjunacore.ATCoordinator, AtomicAction, com.arjuna.mwlabs.wscf.model.sagas.arjunacore.BACoordinator

public class TwoPhaseCoordinator extends BasicAction implements Reapable
Adds support for synchronizations to BasicAction. It does not change thread associations either. It also allows any thread to terminate a transaction, even if it is not the transaction that is marked as current for the thread (unlike the BasicAction default).
Since:
JTS 3.0.
Version:
$Id: TwoPhaseCoordinator.java 2342 2006-03-30 13:06:17Z $
Author:
Mark Little (mark@arjuna.com)
  • Constructor Details

    • TwoPhaseCoordinator

      public TwoPhaseCoordinator()
    • TwoPhaseCoordinator

      public TwoPhaseCoordinator(Uid id)
    • TwoPhaseCoordinator

      protected TwoPhaseCoordinator(int at)
    • TwoPhaseCoordinator

      protected TwoPhaseCoordinator(Uid u, int at)
  • Method Details

    • start

      public int start()
    • start

      public int start(BasicAction parentAction)
    • end

      public int end(boolean report_heuristics)
    • cancel

      public int cancel()
      If this method is called and a transaction is not in a status of RUNNING, ABORT_ONLY or COMMITTING then do not call afterCompletion. A scenario where this may occur is if during the completion of a previous transaction, a runtime exception is thrown from one of the AbstractRecords methods. RuntimeExceptions are not part of the contract of the API and as such all we can do is leave the transaction alone.
      Specified by:
      cancel in interface Reapable
    • addSynchronization

      public int addSynchronization(SynchronizationRecord sr)
    • running

      public boolean running()
      Specified by:
      running in interface Reapable
      Returns:
      true if the transaction is running, false otherwise.
    • type

      public String type()
      Overloads BasicAction.type()
      Overrides:
      type in class BasicAction
    • getDeferredThrowable

      public Throwable getDeferredThrowable()
      Get any Throwable that was caught during commit processing but not directly rethrown.
      Returns:
      the Throwable, if any
    • beforeCompletion

      protected boolean beforeCompletion()
      Drive beforeCompletion participants.
      Returns:
      true if successful, false otherwise.
    • asyncAfterCompletion

      protected boolean asyncAfterCompletion(int myStatus, boolean report_heuristics)
    • afterCompletion

      protected boolean afterCompletion(int myStatus)
      Drive afterCompletion participants.
      Parameters:
      myStatus - the outcome of the transaction (ActionStatus.COMMITTED or ActionStatus.ABORTED).
      Returns:
      true if successful, false otherwise.
    • afterCompletion

      protected boolean afterCompletion(int myStatus, boolean report_heuristics)
      Drive afterCompletion participants.
      Parameters:
      myStatus - the outcome of the transaction (ActionStatus.COMMITTED or ActionStatus.ABORTED).
      report_heuristics - does the caller want to be informed about heurisitics at the point of invocation?
      Returns:
      true if successful, false otherwise.
    • getSynchronizations

      public Map<Uid,String> getSynchronizations()
    • recordStackTraces

      public void recordStackTraces()
      Specified by:
      recordStackTraces in interface Reapable
      Overrides:
      recordStackTraces in class BasicAction
    • outputCapturedStackTraces

      public void outputCapturedStackTraces()
      Specified by:
      outputCapturedStackTraces in interface Reapable
      Overrides:
      outputCapturedStackTraces in class BasicAction