Class ExtendedResourceRecord
java.lang.Object
com.arjuna.ats.arjuna.StateManager
com.arjuna.ats.arjuna.coordinator.AbstractRecord
com.arjuna.ats.internal.jts.resources.ExtendedResourceRecord
This abstract record is used whenever resources are derived from the
ArjunaOTS module's AbstractRecord interface. This gives users the flexibility
of the original Arjuna system's AbstractRecord, and makes resources behave
correctly!
We know that instances of this record will only be called for instances of
AbstractRecord objects.
- Since:
- JTS 1.0.
- Version:
- $Id: ExtendedResourceRecord.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
ConstructorDescriptionProtected constructor used by crash recovery.ExtendedResourceRecord
(boolean propagate, Uid objUid, ArjunaSubtranAwareResource theResource, Coordinator myParent, Uid recCoordUid, ArjunaTransactionImple current) -
Method Summary
Modifier and TypeMethodDescriptionvoid
alter
(AbstractRecord absRec) Alter the current record with the one presented.boolean
doSave()
Should this record be saved in the intentions list? If the record is saved, then it may be recovered later in the event of a failure.boolean
Forget any heuristic outcome which this implementation may have produced.final Uid
getRCUid()
void
merge
(AbstractRecord absRec) Merge the current record with the one presented.int
General nesting rules: Only SubtransactionAware resources get registered with nested actions.int
A commit of a nested transaction has occurred.int
Perform a nested one phase commit.int
Because resource is an Arjuna AbstractRecord we can do proper nesting!order()
Return the Uid of this abstract record so that it can be ordered in the intentions list.void
print
(PrintWriter strm) Write information about this specific instance to the specified stream.boolean
Determine if records are discarded on action abort or must be propagated to parents.boolean
Determine if records are discarded on action commit or must be propagated to parents.Specific OTS method for getting at the value.boolean
restore_state
(InputObjectState os, int t) restore_state and save_state for ExtendedResourceRecords doesn't generally apply due to object pointers.boolean
save_state
(OutputObjectState os, int t) restore_state and save_state for ExtendedResourceRecords doesn't generally apply due to object pointers.void
boolean
shouldAdd
(AbstractRecord absRec) Should we add the record presented to the intentions list?boolean
shouldAlter
(AbstractRecord absRec) Should we alter the current record with the one presented?boolean
shouldMerge
(AbstractRecord absRec) Should we merge the current record with the one presented?boolean
shouldReplace
(AbstractRecord absRec) 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.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, equals, getNext, getPrevious, getTypeOfObject, greaterThan, isPermittedTopLevelOnePhaseCommit, lessThan, nestedCleanup, replace, 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
-
ExtendedResourceRecord
public ExtendedResourceRecord(boolean propagate, Uid objUid, ArjunaSubtranAwareResource theResource, Coordinator myParent, Uid recCoordUid, ArjunaTransactionImple current) - Parameters:
propagate
- tells us whether to propagate the resource at nested commit or not.theResource
- is the proxy that allows us to call out to the object.myParent
- is the proxy for the parent coordinator needed in commit_subtransaction.
-
ExtendedResourceRecord
public ExtendedResourceRecord()Protected constructor used by crash recovery.
-
-
Method Details
-
resourceHandle
Specific OTS method for getting at the value. -
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
.
-
propagateOnAbort
public boolean propagateOnAbort()Description copied from class:AbstractRecord
Determine if records are discarded on action abort or must be propagated to parents.- Overrides:
propagateOnAbort
in classAbstractRecord
- Returns:
true
if the record should be propagated to the parent transaction if the current transaction rolls back,false
otherwise. The default isfalse
.
-
order
Description copied from class:AbstractRecord
Return the Uid of this abstract record so that it can be ordered in the intentions list. This is also the Uid that the record was saved with in the object store.- Overrides:
order
in classAbstractRecord
- Returns:
Uid
for this instance.- See Also:
-
typeIs
public int typeIs()- Specified by:
typeIs
in classAbstractRecord
- Returns:
RecordType
value.
-
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
-
nestedAbort
public int nestedAbort()General nesting rules: Only SubtransactionAware resources get registered with nested actions. The ExtendedResourceRecord creator is assumed to ensure that plain Resources are only registered with the appropriate top level action. That said the _propagateRecord flag ensures that resources registered via register_subtran only take part in the action they where registered in after which they are dropped.- 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()Because resource is an Arjuna AbstractRecord we can do proper nesting!- 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:
-
nestedOnePhaseCommit
public int nestedOnePhaseCommit()Description copied from class:AbstractRecord
Perform a nested one phase commit.- Overrides:
nestedOnePhaseCommit
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:
-
forgetHeuristic
public boolean forgetHeuristic()Description copied from class:AbstractRecord
Forget any heuristic outcome which this implementation may have produced.- Overrides:
forgetHeuristic
in classAbstractRecord
- Returns:
true
by default. Iffalse
is returned then the instance must be remembered by the transaction (in the log) in order for recovery to retry later or for a system administrator to be able to determine which resources have not been successfully completed.
-
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.
-
restore_state
restore_state and save_state for ExtendedResourceRecords doesn't generally apply due to object pointers. However, we need to save something so we can recover failed transactions. So, rather than insist that all Resources derive from a class which we can guarantee will give us some unique id, we simply rely on string_to_object and object_to_string to be meaningful.- Overrides:
restore_state
in classAbstractRecord
- Returns:
true
if successful,false
otherwise.
-
save_state
restore_state and save_state for ExtendedResourceRecords doesn't generally apply due to object pointers. However, we need to save something so we can recover failed transactions. So, rather than insist that all Resources derive from a class which we can guarantee will give us some unique id, we simply rely on string_to_object and object_to_string to be meaningful.- Overrides:
save_state
in classAbstractRecord
- Returns:
true
if successful,false
otherwise.
-
type
Description copied from class:AbstractRecord
Re-implementation of abstract methods inherited from base class.- Overrides:
type
in classAbstractRecord
-
doSave
public boolean doSave()Description copied from class:AbstractRecord
Should this record be saved in the intentions list? If the record is saved, then it may be recovered later in the event of a failure. Note, however, that the size of the intentions list on disk is critical to the performance of the system (disk I/O is a bottleneck).- Overrides:
doSave
in classAbstractRecord
- Returns:
true
if it should be saved,false
otherwise.false
is the default.
-
getRCUid
-
merge
Description copied from class:AbstractRecord
Merge the current record with the one presented.- Specified by:
merge
in classAbstractRecord
- Parameters:
absRec
- 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:
absRec
- the record with which to alter.
-
shouldAdd
Description copied from class:AbstractRecord
Should we add the record presented to the intentions list?- Specified by:
shouldAdd
in classAbstractRecord
- Parameters:
absRec
- The record to try to add.- Returns:
true
if the record should be added,false
otherwise.
-
shouldAlter
Description copied from class:AbstractRecord
Should we alter the current record with the one presented?- Specified by:
shouldAlter
in classAbstractRecord
- Parameters:
absRec
- The record to try to alter.- Returns:
true
if the record should be altered,false
otherwise.
-
shouldMerge
Description copied from class:AbstractRecord
Should we merge the current record with the one presented?- Specified by:
shouldMerge
in classAbstractRecord
- Parameters:
absRec
- 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:
absRec
- The record to try to replace.- Returns:
true
if the record should be replaced,false
otherwise.
-