Class CadaverRecord
java.lang.Object
com.arjuna.ats.arjuna.StateManager
com.arjuna.ats.arjuna.coordinator.AbstractRecord
com.arjuna.ats.internal.arjuna.abstractrecords.RecoveryRecord
com.arjuna.ats.internal.arjuna.abstractrecords.PersistenceRecord
com.arjuna.ats.internal.arjuna.abstractrecords.CadaverRecord
- Direct Known Subclasses:
DisposeRecord
Cadaver records are created whenever a persistent object is deleted while
still in the scope of an atomic action. This ensures that if the
action commits the state of the persistent objects gets properly
reflected back in the object participantStore. For objects that are only
recoverable such work is unnecessary. Cadaver records replace
PersistenceRecords in the record list of an atomic action so they must
be merged with such records to enable both commits and aborts to occur.
- Since:
- JTS 1.0.
- Version:
- $Id: CadaverRecord.java 2342 2006-03-30 13:06:17Z $
- Author:
- Mark Little (mark@arjuna.com)
-
Field Summary
Fields inherited from class com.arjuna.ats.internal.arjuna.abstractrecords.PersistenceRecord
classicPrepare, MAX_OBJECT_SIZE, shadowMade, targetParticipantStore, topLevelState
Fields inherited from class com.arjuna.ats.internal.arjuna.abstractrecords.RecoveryRecord
objectAddr, state
Fields inherited from class com.arjuna.ats.arjuna.StateManager
modifyingActions, objectModel, objectUid, synchronizationLock, usingActions
-
Constructor Summary
ConstructorsConstructorDescriptionCreate a new instance using default values.CadaverRecord
(OutputObjectState os, ParticipantStore participantStore, StateManager sm) Create a new instance, passing in the object that is being managed. -
Method Summary
Modifier and TypeMethodDescriptionboolean
doSave()
Override the AbstractRecord.doSave.void
merge
(AbstractRecord mergewith) merge takes the information from the incoming PersistenceRecord and uses it to initialise the oldState information.int
The nested transaction has aborted.int
The nested transaction is preparing.void
print
(PrintWriter strm) Override AbstractRecord.print to write specific information to the specified stream.boolean
Override default AbstractRecord method.boolean
Overrides AbstractRecord.shouldMergeboolean
Overrides AbstractRecord.shouldReplaceint
The nested transaction has aborted.int
At topLevelCommit we commit the uncommitted version already saved into object participantStore.int
At topLevelPrepare write uncommitted version into object participantStore.type()
The type of the class - may be used to save information in an hierarchical manner in the object participantStore.int
typeIs()
The type of the record.Methods inherited from class com.arjuna.ats.internal.arjuna.abstractrecords.PersistenceRecord
restore_state, save_state, shadowForced, topLevelCleanup
Methods inherited from class com.arjuna.ats.internal.arjuna.abstractrecords.RecoveryRecord
alter, forgetAction, nestedCommit, setValue, shouldAdd, shouldAlter, value
Methods inherited from class com.arjuna.ats.arjuna.coordinator.AbstractRecord
clearAnyCachedData, clearHeuristicDecision, create, equals, forgetHeuristic, getNext, getPrevious, getTypeOfObject, greaterThan, isPermittedTopLevelOnePhaseCommit, lessThan, nestedCleanup, nestedOnePhaseCommit, order, propagateOnCommit, replace, setNext, setPrevious, topLevelOnePhaseCommit
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
-
CadaverRecord
Create a new instance, passing in the object that is being managed.- Parameters:
os
- the state of the object that is being removed.participantStore
- the object participantStore instance used to manipulate the persistent state.sm
- the object being removed.
-
CadaverRecord
public CadaverRecord()Create a new instance using default values. Typically used during failure recovery.
-
-
Method Details
-
propagateOnAbort
public boolean propagateOnAbort()Override default AbstractRecord method. CadaverRecords are propagated regardless of the termination condition.- Overrides:
propagateOnAbort
in classAbstractRecord
- Returns:
true
-
typeIs
public int typeIs()The type of the record.- Overrides:
typeIs
in classPersistenceRecord
- Returns:
- RecordType.PERSISTENT
- See Also:
-
nestedAbort
public int nestedAbort()The nested transaction has aborted. The record will invalidate any new state.- Overrides:
nestedAbort
in classRecoveryRecord
- Returns:
TwoPhaseOutcome
to indicate success/failure.- See Also:
-
nestedPrepare
public int nestedPrepare()The nested transaction is preparing. If there is any new state for the object being removed, and that state is valid, then this record will call nestedPrepare on the object being removed. If we have no new state then we cannot commit and must force an abort. Do this by failing the prepare phase.- Overrides:
nestedPrepare
in classRecoveryRecord
- Returns:
TwoPhaseOutcome
to indicate success/failure.- See Also:
-
topLevelAbort
public int topLevelAbort()The nested transaction has aborted. Invalidate any new state.- Overrides:
topLevelAbort
in classPersistenceRecord
- Returns:
TwoPhaseOutcome
to indicate success/failure.- See Also:
-
topLevelCommit
public int topLevelCommit()At topLevelCommit we commit the uncommitted version already saved into object participantStore. Cannot use inherited version since that assumes object is alive instead talk directly to the object participantStore itself.- Overrides:
topLevelCommit
in classPersistenceRecord
- Returns:
TwoPhaseOutcome
to indicate success/failure.- See Also:
-
topLevelPrepare
public int topLevelPrepare()At topLevelPrepare write uncommitted version into object participantStore. Cannot use inherited version since that assumes object is alive instead talk directly to the object participantStore itself.- Overrides:
topLevelPrepare
in classPersistenceRecord
- Returns:
TwoPhaseOutcome
to indicate success/failure.- See Also:
-
print
Override AbstractRecord.print to write specific information to the specified stream.- Overrides:
print
in classPersistenceRecord
- Parameters:
strm
- the stream to use.
-
type
The type of the class - may be used to save information in an hierarchical manner in the object participantStore.- Overrides:
type
in classPersistenceRecord
-
doSave
public boolean doSave()Override the AbstractRecord.doSave.- Overrides:
doSave
in classPersistenceRecord
- Returns:
true
if the object being removed is a persistent object (RecordType.PERSISTENT).false
otherwise.- See Also:
-
merge
merge takes the information from the incoming PersistenceRecord and uses it to initialise the oldState information. This is required for processing of action aborts since CadaverRecords maintain the final state of an object normally - which is required if the action commits.- Overrides:
merge
in classRecoveryRecord
- Parameters:
mergewith
- The record to merge with.
-
shouldMerge
Overrides AbstractRecord.shouldMerge- Overrides:
shouldMerge
in classRecoveryRecord
- Parameters:
ar
- the record to potentially merge with.- Returns:
true
if this instance and the parameter have the same id (order()) and the parameter is either persistent or recoverable.false
otherwise.- See Also:
-
shouldReplace
Overrides AbstractRecord.shouldReplace- Overrides:
shouldReplace
in classRecoveryRecord
- Parameters:
ar
- the record to potentially replace this instance.- Returns:
true
if this instance and the parameter have the same id (order()) and the parameter is either persistent or recoverable.false
otherwise.- See Also:
-