Class TwoPhaseCoordinator

  • All Implemented Interfaces:
    Reapable
    Direct Known Subclasses:
    AtomicAction

    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 Detail

      • TwoPhaseCoordinator

        public TwoPhaseCoordinator()
      • TwoPhaseCoordinator

        public TwoPhaseCoordinator​(Uid id)
      • TwoPhaseCoordinator

        protected TwoPhaseCoordinator​(int at)
      • TwoPhaseCoordinator

        protected TwoPhaseCoordinator​(Uid u,
                                      int at)
    • Method Detail

      • 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
      • running

        public boolean running()
        Specified by:
        running in interface Reapable
        Returns:
        true if the transaction is running, false otherwise.
      • 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()