Class LastResourceRecord
java.lang.Object
com.arjuna.ats.arjuna.StateManager
com.arjuna.ats.arjuna.coordinator.AbstractRecord
com.arjuna.ats.internal.arjuna.abstractrecords.LastResourceRecord
AbstractRecord that helps us do the last resource commit optimization.
Basically this is something that is used to allow a *single* resource that is
only one-phase aware to be enlisted with a transaction that is usually
two-phase. The way it works is: (i) the coordinator runs its normal first
(prepare) phase on all two-phase aware participants and makes a decision
based solely on their responses as to whether to commit or roll back. Note,
the one-phase aware resource essentially returns voteCommit during prepare,
to ensure that the second phase runs even if all other resources return
voteReadOnly. (ii) if the transaction is to commit then the coordinator
invokes the second phase on *all* participants, starting with the one that is
only one-phase aware. If it rolls back, it rolls all resources back, but the
order is not important.
- Since:
- ATS 3.2.
- Version:
- $Id: LastResourceRecord.java 2342 2006-03-30 13:06:17Z $
- Author:
- Mark Little (mark@arjuna.com)
-
Field Summary
Fields inherited from class com.arjuna.ats.arjuna.StateManager
modifyingActions, objectModel, objectUid, synchronizationLock, usingActions
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Alter the current record with the one presented.void
Merge the current record with the one presented.int
A rollback of a nested transaction has occurred.int
A commit of a nested transaction has occurred.int
Not allowed to participate in nested transactions.void
print
(PrintWriter strm) Write information about this specific instance to the specified stream.boolean
Determine if records are discarded on action commit or must be propagated to parents.void
setOutcome
(int outcome) void
boolean
Should we add the record presented to the intentions list?boolean
Should we alter the current record with the one presented?boolean
Should we merge the current record with the one presented?boolean
Should we replace the record presented with the current record?int
A rollback of a top-level transaction has occurred.int
A commit of a top-level transaction has occurred.int
Perform a top-level one phase commit.int
A prepare for a top-level transaction has occurred.toString()
type()
Re-implementation of abstract methods inherited from base class.int
typeIs()
value()
If this abstract record caused a heuristic then it should return an object which implementsHeuristicInformation
Methods inherited from class com.arjuna.ats.arjuna.coordinator.AbstractRecord
clearHeuristicDecision, create, doSave, equals, forgetHeuristic, getNext, getPrevious, getTypeOfObject, greaterThan, isPermittedTopLevelOnePhaseCommit, lessThan, nestedCleanup, nestedOnePhaseCommit, order, propagateOnAbort, replace, restore_state, save_state, setNext, setPrevious, topLevelCleanup
Methods inherited from class com.arjuna.ats.arjuna.StateManager
activate, activate, cleanup, createLists, deactivate, deactivate, deactivate, destroy, disable, forgetAction, get_uid, getCreationTimeMillis, getMutex, getObjectModel, getStore, getStoreRoot, loadObjectState, lockMutex, modified, objectType, packHeader, persist, rememberAction, setStatus, setupStore, setupStore, setupStore, status, terminate, tryLockMutex, unlockMutex, unpackHeader
-
Constructor Details
-
LastResourceRecord
-
LastResourceRecord
public LastResourceRecord()
-
-
Method Details
-
propagateOnCommit
public boolean propagateOnCommit()Description copied from class:AbstractRecord
Determine if records are discarded on action commit or must be propagated to parents.- Overrides:
propagateOnCommit
in classAbstractRecord
- Returns:
true
if the record should be propagated to the parent transaction if the current transaction commits,false
otherwise. The default istrue
.
-
typeIs
public int typeIs()- Specified by:
typeIs
in classAbstractRecord
- Returns:
RecordType
value.
-
nestedAbort
public int nestedAbort()Description copied from class:AbstractRecord
A rollback of a nested transaction has occurred.- Specified by:
nestedAbort
in classAbstractRecord
- Returns:
TwoPhaseOutcome
to indicate success/failure.- See Also:
-
nestedCommit
public int nestedCommit()Description copied from class:AbstractRecord
A commit of a nested transaction has occurred.- Specified by:
nestedCommit
in classAbstractRecord
- Returns:
TwoPhaseOutcome
to indicate success/failure.- See Also:
-
nestedPrepare
public int nestedPrepare()Not allowed to participate in nested transactions.- Specified by:
nestedPrepare
in classAbstractRecord
- Returns:
TwoPhaseOutcome
to indicate success/failure.- See Also:
-
topLevelAbort
public int topLevelAbort()Description copied from class:AbstractRecord
A rollback of a top-level transaction has occurred.- Specified by:
topLevelAbort
in classAbstractRecord
- Returns:
TwoPhaseOutcome
to indicate success/failure.- See Also:
-
topLevelCommit
public int topLevelCommit()Description copied from class:AbstractRecord
A commit of a top-level transaction has occurred.- Specified by:
topLevelCommit
in classAbstractRecord
- Returns:
TwoPhaseOutcome
to indicate success/failure.- See Also:
-
topLevelPrepare
public int topLevelPrepare()Description copied from class:AbstractRecord
A prepare for a top-level transaction has occurred.- Specified by:
topLevelPrepare
in classAbstractRecord
- Returns:
TwoPhaseOutcome
to indicate success/failure.- See Also:
-
topLevelOnePhaseCommit
public int topLevelOnePhaseCommit()Description copied from class:AbstractRecord
Perform a top-level one phase commit.- Overrides:
topLevelOnePhaseCommit
in classAbstractRecord
- Returns:
TwoPhaseOutcome
to indicate success/failure.- See Also:
-
toString
-
print
Description copied from class:AbstractRecord
Write information about this specific instance to the specified stream.- Overrides:
print
in classAbstractRecord
- Parameters:
strm
- the stream on which to output.
-
type
Description copied from class:AbstractRecord
Re-implementation of abstract methods inherited from base class.- Overrides:
type
in classAbstractRecord
-
shouldAdd
Description copied from class:AbstractRecord
Should we add the record presented to the intentions list?- Specified by:
shouldAdd
in classAbstractRecord
- Parameters:
a
- The record to try to add.- Returns:
true
if the record should be added,false
otherwise.
-
shouldMerge
Description copied from class:AbstractRecord
Should we merge the current record with the one presented?- Specified by:
shouldMerge
in classAbstractRecord
- Parameters:
a
- The record to try to merge.- Returns:
true
if the record should be merged,false
otherwise.
-
shouldReplace
Description copied from class:AbstractRecord
Should we replace the record presented with the current record?- Specified by:
shouldReplace
in classAbstractRecord
- Parameters:
a
- The record to try to replace.- Returns:
true
if the record should be replaced,false
otherwise.
-
shouldAlter
Description copied from class:AbstractRecord
Should we alter the current record with the one presented?- Specified by:
shouldAlter
in classAbstractRecord
- Parameters:
a
- The record to try to alter.- Returns:
true
if the record should be altered,false
otherwise.
-
merge
Description copied from class:AbstractRecord
Merge the current record with the one presented.- Specified by:
merge
in classAbstractRecord
- Parameters:
a
- the record with which to merge.
-
alter
Description copied from class:AbstractRecord
Alter the current record with the one presented.- Specified by:
alter
in classAbstractRecord
- Parameters:
a
- the record with which to alter.
-
value
Description copied from class:AbstractRecord
If this abstract record caused a heuristic then it should return an object which implementsHeuristicInformation
- Specified by:
value
in classAbstractRecord
- Returns:
Object
to be used to order.
-
setValue
- Specified by:
setValue
in classAbstractRecord
-
setOutcome
public void setOutcome(int outcome)
-