Class ServerTransaction
java.lang.Object
com.arjuna.ats.arjuna.StateManager
com.arjuna.ats.arjuna.coordinator.BasicAction
com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator
com.arjuna.ats.internal.jts.orbspecific.coordinator.ArjunaTransactionImple
com.arjuna.ats.internal.jts.orbspecific.interposition.coordinator.ServerTransaction
- All Implemented Interfaces:
ArjunaTransactionOperations
,UidCoordinatorOperations
,Reapable
,CoordinatorOperations
,TerminatorOperations
- Direct Known Subclasses:
RecoveredServerTransaction
,ServerTransaction
,ServerTransactionWrapper
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 Summary
Fields inherited from class com.arjuna.ats.internal.jts.orbspecific.coordinator.ArjunaTransactionImple
controlHandle, parentTransaction
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
ModifierConstructorDescriptionprotected
ServerTransaction
(Uid recoveringActUid) Used during crash recovery.ServerTransaction
(Uid actUid, Control myParent) ServerTransaction
(Uid actUid, Control myParent, ArjunaTransactionImple parentImpl) -
Method Summary
Modifier and TypeMethodDescriptionvoid
void
void
doCommit
(boolean report_heuristics) final void
doForget()
final int
final int
final int
void
finalize()
protected final int
void
register_synchronization
(Synchronization theSync) 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.boolean
restore_state
(InputObjectState os, int ot) This assumes the various lists are zero length when it is called.void
rollback()
boolean
save_state
(OutputObjectState os, int ot) Redefined version of save_state and restore_state from StateManager.final void
setRecoveryCoordinator
(RecoveryCoordinator recCoord) toString()
Overloads Object.toString()type()
Overloads BasicAction.type()static String
typeName()
Methods inherited from class com.arjuna.ats.internal.jts.orbspecific.coordinator.ArjunaTransactionImple
commit, create_subtransaction, createOTSRecord, createOTSRecord, destroyAction, equals, forgetHeuristics, get_parent_status, get_status, get_top_level_status, get_transaction_name, get_txcontext, getControlHandle, getSynchronizations, hash_top_level_tran, hash_transaction, interpositionType, is_ancestor_transaction, is_descendant_transaction, is_related_transaction, is_same_transaction, is_top_level_transaction, register_resource, register_subtran_aware, rollback_only, setControlHandle, topLevelUid, uid
Methods inherited from class com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator
addSynchronization, afterCompletion, afterCompletion, asyncAfterCompletion, beforeCompletion, cancel, end, getDeferredThrowable, outputCapturedStackTraces, recordStackTraces, running, start, start
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, finalizeInternal, getDeferredThrowables, getHeuristicDecision, getHierarchy, getStore, hashCode, hierarchyDepth, insertRecord, isAncestor, maintainHeuristics, onePhaseCommit, onePhaseCommit, parent, phase2Abort, phase2Cleanup, phase2Commit, prepare, preventCommit, removeChildAction, removeChildThread, removeChildThread, setCheckedAction, setHeuristicDecision, status, topLevelAction, topLevelActionUid, 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 interface com.arjuna.ats.arjuna.coordinator.Reapable
get_uid, preventCommit
-
Field Details
-
_recoveryCoordinator
-
-
Constructor Details
-
ServerTransaction
-
ServerTransaction
-
ServerTransaction
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 classArjunaTransactionImple
-
type
Description copied from class:TwoPhaseCoordinator
Overloads BasicAction.type()- Overrides:
type
in classArjunaTransactionImple
-
getSavingUid
- Overrides:
getSavingUid
in classBasicAction
- 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 interfaceTerminatorOperations
- Overrides:
rollback
in classArjunaTransactionImple
- 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 interfaceCoordinatorOperations
- Overrides:
register_synchronization
in classArjunaTransactionImple
- Throws:
Inactive
SynchronizationUnavailable
org.omg.CORBA.SystemException
-
doBeforeCompletion
public void doBeforeCompletion() throws org.omg.CORBA.SystemException- Overrides:
doBeforeCompletion
in classArjunaTransactionImple
- Throws:
org.omg.CORBA.SystemException
-
doAfterCompletion
- Overrides:
doAfterCompletion
in classArjunaTransactionImple
- Throws:
org.omg.CORBA.SystemException
-
typeName
-
setRecoveryCoordinator
-
save_state
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 classBasicAction
- Returns:
true
if successful,false
otherwise.
-
restore_state
Description copied from class:BasicAction
This assumes the various lists are zero length when it is called.- Overrides:
restore_state
in classBasicAction
- Returns:
true
if successful,false
otherwise.
-
toString
Description copied from class:BasicAction
Overloads Object.toString()- Overrides:
toString
in classArjunaTransactionImple
-
preparedStatus
protected final int preparedStatus()- Overrides:
preparedStatus
in classBasicAction
- Returns:
- the transaction's prepared status.
-