Class ArjunaTransactionImple
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
- All Implemented Interfaces:
ArjunaTransactionOperations
,UidCoordinatorOperations
,Reapable
,CoordinatorOperations
,TerminatorOperations
- Direct Known Subclasses:
ArjunaTransactionImpleWrapper
,RecoveredTransaction
,ServerTransaction
public class ArjunaTransactionImple
extends TwoPhaseCoordinator
implements ArjunaTransactionOperations
OTS implementation class.
Implements both the Coordinator invalid input: '&' Terminator interfaces of OTS as a single
class.
Note, because Java does not support multiple inheritance we must make use of
the tie facility (uuuggghhhh!!!!)
- Since:
- JTS 1.0.
- Version:
- $Id: ArjunaTransactionImple.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
ModifierConstructorDescriptionprotected
ArjunaTransactionImple
(Uid actUid) For crash recovery purposes only.ArjunaTransactionImple
(Uid actUid, Control myParent) ArjunaTransactionImple
(Uid actUid, Control myParent, ArjunaTransactionImple parent) ArjunaTransactionImple
(Control myParent) ArjunaTransactionImple
(Control myParent, ArjunaTransactionImple parent) -
Method Summary
Modifier and TypeMethodDescriptionvoid
commit
(boolean report_heuristics) If the transaction has already been committed (by another thread, for example) then we do nothing - could throw TransactionRequired or INVALID_TRANSACTION.protected final AbstractRecord
createOTSRecord
(boolean propagate, Resource resource, Coordinator coord) protected final AbstractRecord
createOTSRecord
(boolean propagate, Resource resource, Coordinator coord, Uid recCoordUid) protected final void
protected void
doAfterCompletion
(Status myStatus) protected void
boolean
void
finalize()
boolean
Forget any heuristics we may have received, and tell the resources which generated them to forget too.To be used for debugging purposes only.final ControlImple
int
int
static final int
boolean
Is this transaction an ancestor of tc?boolean
Is this transaction a descendant of tc?boolean
boolean
boolean
Resources are only registered with the current transaction, whereas subtransaction aware resources are registered with their parents when the current transaction ends.void
Do not propagate the resource to the parent.void
The spec states that a synchronization is registered with a single top-level action only.void
rollback()
void
final void
setControlHandle
(ControlImple handle) toString()
Overloads Object.toString()type()
Overloads BasicAction.type()static String
typeName()
uid()
We use these to determine relationships between transactions.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, 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, 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
-
parentTransaction
-
controlHandle
-
-
Constructor Details
-
ArjunaTransactionImple
-
ArjunaTransactionImple
-
ArjunaTransactionImple
-
ArjunaTransactionImple
-
ArjunaTransactionImple
For crash recovery purposes only.
-
-
Method Details
-
finalize
public void finalize() -
getControlHandle
-
setControlHandle
-
commit
public void commit(boolean report_heuristics) throws HeuristicMixed, HeuristicHazard, org.omg.CORBA.SystemException If the transaction has already been committed (by another thread, for example) then we do nothing - could throw TransactionRequired or INVALID_TRANSACTION. However, if it was rolledback then we throw TRANSACTION_ROLLEDBACK. Seems like an inconsistency. OTS is vague as to what to do if the transaction has been terminated, so we make a sensible choice. report_heuristics is ignored if we are a subtransaction.- Specified by:
commit
in interfaceTerminatorOperations
- Throws:
HeuristicMixed
HeuristicHazard
org.omg.CORBA.SystemException
-
rollback
public void rollback() throws org.omg.CORBA.SystemException- Specified by:
rollback
in interfaceTerminatorOperations
- Throws:
org.omg.CORBA.SystemException
-
get_status
- Specified by:
get_status
in interfaceCoordinatorOperations
- Throws:
org.omg.CORBA.SystemException
-
get_parent_status
- Specified by:
get_parent_status
in interfaceCoordinatorOperations
- Throws:
org.omg.CORBA.SystemException
-
get_top_level_status
- Specified by:
get_top_level_status
in interfaceCoordinatorOperations
- Throws:
org.omg.CORBA.SystemException
-
is_same_transaction
- Specified by:
is_same_transaction
in interfaceCoordinatorOperations
- Throws:
org.omg.CORBA.SystemException
-
is_ancestor_transaction
Is this transaction an ancestor of tc?- Specified by:
is_ancestor_transaction
in interfaceCoordinatorOperations
- Throws:
org.omg.CORBA.SystemException
-
is_descendant_transaction
Is this transaction a descendant of tc?- Specified by:
is_descendant_transaction
in interfaceCoordinatorOperations
- Throws:
org.omg.CORBA.SystemException
-
is_top_level_transaction
public boolean is_top_level_transaction() throws org.omg.CORBA.SystemException- Specified by:
is_top_level_transaction
in interfaceCoordinatorOperations
- Throws:
org.omg.CORBA.SystemException
-
hash_transaction
public int hash_transaction() throws org.omg.CORBA.SystemException- Specified by:
hash_transaction
in interfaceCoordinatorOperations
- Throws:
org.omg.CORBA.SystemException
-
hash_top_level_tran
public int hash_top_level_tran() throws org.omg.CORBA.SystemException- Specified by:
hash_top_level_tran
in interfaceCoordinatorOperations
- Throws:
org.omg.CORBA.SystemException
-
register_resource
public RecoveryCoordinator register_resource(Resource r) throws org.omg.CORBA.SystemException, Inactive Resources are only registered with the current transaction, whereas subtransaction aware resources are registered with their parents when the current transaction ends.- Specified by:
register_resource
in interfaceCoordinatorOperations
- Throws:
org.omg.CORBA.SystemException
Inactive
-
register_subtran_aware
public void register_subtran_aware(SubtransactionAwareResource r) throws Inactive, NotSubtransaction, org.omg.CORBA.SystemException Do not propagate the resource to the parent.- Specified by:
register_subtran_aware
in interfaceCoordinatorOperations
- Throws:
Inactive
NotSubtransaction
org.omg.CORBA.SystemException
-
rollback_only
- Specified by:
rollback_only
in interfaceCoordinatorOperations
- Throws:
org.omg.CORBA.SystemException
Inactive
-
get_transaction_name
To be used for debugging purposes only.- Specified by:
get_transaction_name
in interfaceCoordinatorOperations
- Throws:
org.omg.CORBA.SystemException
-
create_subtransaction
public Control create_subtransaction() throws org.omg.CORBA.SystemException, SubtransactionsUnavailable, Inactive- Specified by:
create_subtransaction
in interfaceCoordinatorOperations
- Throws:
org.omg.CORBA.SystemException
SubtransactionsUnavailable
Inactive
-
register_synchronization
public void register_synchronization(Synchronization sync) throws Inactive, SynchronizationUnavailable, org.omg.CORBA.SystemException The spec states that a synchronization is registered with a single top-level action only. However, if this is a nested transaction there is no appropriate exception to raise. So, we raise SynchronizationUnavailable. We could simply get our parent and register the synchronization with it, but this may not be what the user expects. If it is, then the user can get the parent and do it directly!- Specified by:
register_synchronization
in interfaceCoordinatorOperations
- Throws:
Inactive
SynchronizationUnavailable
org.omg.CORBA.SystemException
-
get_txcontext
- Specified by:
get_txcontext
in interfaceCoordinatorOperations
- Throws:
Unavailable
org.omg.CORBA.SystemException
-
uid
We use these to determine relationships between transactions. Using the hash function is not sufficient, since a hash value is not guaranteed to be unique.- Specified by:
uid
in interfaceUidCoordinatorOperations
- Throws:
org.omg.CORBA.SystemException
-
topLevelUid
- Specified by:
topLevelUid
in interfaceUidCoordinatorOperations
- Throws:
org.omg.CORBA.SystemException
-
type
Description copied from class:TwoPhaseCoordinator
Overloads BasicAction.type()- Overrides:
type
in classTwoPhaseCoordinator
-
interpositionType
public static final int interpositionType() -
typeName
-
toString
Description copied from class:BasicAction
Overloads Object.toString()- Overrides:
toString
in classBasicAction
-
equals
- Overrides:
equals
in classBasicAction
-
forgetHeuristics
public boolean forgetHeuristics()Description copied from class:BasicAction
Forget any heuristics we may have received, and tell the resources which generated them to forget too.- Overrides:
forgetHeuristics
in classBasicAction
- Returns:
true
if heuristic information (if any) was successfully forgotten,false
otherwise.
-
doBeforeCompletion
protected void doBeforeCompletion() throws org.omg.CORBA.SystemException- Throws:
org.omg.CORBA.SystemException
-
doAfterCompletion
- Throws:
org.omg.CORBA.SystemException
-
createOTSRecord
protected final AbstractRecord createOTSRecord(boolean propagate, Resource resource, Coordinator coord) -
createOTSRecord
protected final AbstractRecord createOTSRecord(boolean propagate, Resource resource, Coordinator coord, Uid recCoordUid) -
destroyAction
protected final void destroyAction() -
getSynchronizations
- Overrides:
getSynchronizations
in classTwoPhaseCoordinator
-