Class TwoPhaseCoordinator
- java.lang.Object
-
- com.arjuna.ats.arjuna.StateManager
-
- com.arjuna.ats.arjuna.coordinator.BasicAction
-
- com.arjuna.ats.arjuna.coordinator.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)
-
-
Field Summary
-
Fields inherited from class com.arjuna.ats.arjuna.coordinator.BasicAction
failedList, heuristicList, pendingList, preparedList, readonlyList, savedIntentionList, subordinate, threadStackTraceHistoryList
-
Fields inherited from class com.arjuna.ats.arjuna.StateManager
modifyingActions, objectModel, objectUid, usingActions
-
-
Constructor Summary
Constructors Modifier Constructor Description TwoPhaseCoordinator()protectedTwoPhaseCoordinator(int at)TwoPhaseCoordinator(Uid id)protectedTwoPhaseCoordinator(Uid u, int at)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intaddSynchronization(SynchronizationRecord sr)protected booleanafterCompletion(int myStatus)Drive afterCompletion participants.protected booleanafterCompletion(int myStatus, boolean report_heuristics)Drive afterCompletion participants.protected booleanasyncAfterCompletion(int myStatus, boolean report_heuristics)protected booleanbeforeCompletion()Drive beforeCompletion participants.intcancel()If this method is called and a transaction is not in a status of RUNNING, ABORT_ONLY or COMMITTING then do not call afterCompletion.intend(boolean report_heuristics)java.lang.ThrowablegetDeferredThrowable()Get any Throwable that was caught during commit processing but not directly rethrown.java.util.Map<Uid,java.lang.String>getSynchronizations()voidoutputCapturedStackTraces()voidrecordStackTraces()booleanrunning()intstart()intstart(BasicAction parentAction)java.lang.Stringtype()Overloads BasicAction.type()-
Methods inherited from class com.arjuna.ats.arjuna.coordinator.BasicAction
Abort, Abort, abortStatus, activate, activate, activeThreads, add, addChildAction, addChildThread, addChildThread, addRecord, async_prepare, Begin, checkForCurrent, childTransactions, commitStatus, createStackTraces, criticalEnd, criticalStart, Current, deactivate, destroy, doAbort, doAbort, doCommit, doCommit, doPrepare, End, equals, finalizeInternal, forgetHeuristics, getDeferredThrowables, getHeuristicDecision, getHierarchy, getSavingUid, getStore, hashCode, hierarchyDepth, insertRecord, isAncestor, maintainHeuristics, onePhaseCommit, onePhaseCommit, parent, phase2Abort, phase2Cleanup, phase2Commit, prepare, preparedStatus, preventCommit, removeChildAction, removeChildThread, removeChildThread, restore_state, save_state, setCheckedAction, setHeuristicDecision, status, topLevelAction, topLevelActionUid, toString, typeOfAction, updateHeuristic, updateState
-
Methods inherited from class com.arjuna.ats.arjuna.StateManager
cleanup, createLists, deactivate, deactivate, disable, forgetAction, get_uid, getMutex, getObjectModel, getStoreRoot, loadObjectState, lockMutex, modified, objectType, packHeader, persist, print, rememberAction, setStatus, setupStore, setupStore, setupStore, terminate, tryLockMutex, unlockMutex, unpackHeader
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.arjuna.ats.arjuna.coordinator.Reapable
get_uid, preventCommit
-
-
-
-
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.
-
addSynchronization
public int addSynchronization(SynchronizationRecord sr)
-
running
public boolean running()
-
type
public java.lang.String type()
Overloads BasicAction.type()- Overrides:
typein classBasicAction
-
getDeferredThrowable
public java.lang.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 java.util.Map<Uid,java.lang.String> getSynchronizations()
-
recordStackTraces
public void recordStackTraces()
- Specified by:
recordStackTracesin interfaceReapable- Overrides:
recordStackTracesin classBasicAction
-
outputCapturedStackTraces
public void outputCapturedStackTraces()
- Specified by:
outputCapturedStackTracesin interfaceReapable- Overrides:
outputCapturedStackTracesin classBasicAction
-
-