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:
ArjunaTransactionImple
,com.arjuna.mwlabs.wscf.model.twophase.arjunacore.ATCoordinator
,AtomicAction
,com.arjuna.mwlabs.wscf.model.sagas.arjunacore.BACoordinator
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, synchronizationLock, usingActions
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
TwoPhaseCoordinator
(int at) protected
TwoPhaseCoordinator
(Uid u, int at) -
Method Summary
Modifier and TypeMethodDescriptionint
protected boolean
afterCompletion
(int myStatus) Drive afterCompletion participants.protected boolean
afterCompletion
(int myStatus, boolean report_heuristics) Drive afterCompletion participants.protected boolean
asyncAfterCompletion
(int myStatus, boolean report_heuristics) protected boolean
Drive beforeCompletion participants.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.int
end
(boolean report_heuristics) Get any Throwable that was caught during commit processing but not directly rethrown.void
void
boolean
running()
int
start()
int
start
(BasicAction parentAction) type()
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, getCreationTimeMillis, 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
-
Constructor Details
-
TwoPhaseCoordinator
public TwoPhaseCoordinator() -
TwoPhaseCoordinator
-
TwoPhaseCoordinator
protected TwoPhaseCoordinator(int at) -
TwoPhaseCoordinator
-
-
Method Details
-
start
public int start() -
start
-
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
-
running
public boolean running() -
type
Overloads BasicAction.type()- Overrides:
type
in classBasicAction
-
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
-
recordStackTraces
public void recordStackTraces()- Specified by:
recordStackTraces
in interfaceReapable
- Overrides:
recordStackTraces
in classBasicAction
-
outputCapturedStackTraces
public void outputCapturedStackTraces()- Specified by:
outputCapturedStackTraces
in interfaceReapable
- Overrides:
outputCapturedStackTraces
in classBasicAction
-