Class PersistenceRecord
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
- Direct Known Subclasses:
CadaverRecord
A PersistenceRecord is created whenever a persistent object is
created/read/modified within the scope of a transaction. It is responsible
for ensuring that state changes are committed or rolled back on behalf of the
object depending upon the outcome of the transaction.
- Since:
- JTS 1.0.
- Version:
- $Id: PersistenceRecord.java 2342 2006-03-30 13:06:17Z $
- Author:
- Mark Little (mark@arjuna.com)
-
Field Summary
Modifier and TypeFieldDescriptionprotected static final boolean
static final int
protected boolean
protected ParticipantStore
protected OutputObjectState
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
ConstructorDescriptionCreates a 'blank' persistence record.PersistenceRecord
(OutputObjectState os, ParticipantStore participantStore, StateManager sm) This constructor is used to create a new instance of PersistenceRecord. -
Method Summary
Modifier and TypeMethodDescriptionboolean
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.void
print
(PrintWriter strm) Write information about this specific instance to the specified stream.boolean
restore_state
(InputObjectState os, int ot) During recovery, the transaction log is given to the recovery system and it will recreate a transaction instance to perform necessary recovery actions.boolean
save_state
(OutputObjectState os, int ot) When the transaction is required to make the intentions list persistent, it scans the list and asks each record whether or not it requires state to be saved (by calling doSave).protected boolean
Cadaver records force write shadows.int
topLevelAbort may have to remove the persistent state that was written into the object store during the processing of topLevelPrepare.int
topLevelCleanup must leave the persistent state that was written in the object store during the processing of topLevelPrepare intact.int
commit the state saved during the prepare phase.int
topLevelPrepare attempts to save the object.type()
Re-implementation of abstract methods inherited from base class.int
typeIs()
Redefintions of abstract functions inherited from RecoveryRecord.Methods inherited from class com.arjuna.ats.internal.arjuna.abstractrecords.RecoveryRecord
alter, forgetAction, merge, nestedAbort, nestedCommit, nestedPrepare, setValue, shouldAdd, shouldAlter, shouldMerge, shouldReplace, value
Methods inherited from class com.arjuna.ats.arjuna.coordinator.AbstractRecord
clearHeuristicDecision, create, equals, forgetHeuristic, getNext, getPrevious, getTypeOfObject, greaterThan, isPermittedTopLevelOnePhaseCommit, lessThan, nestedCleanup, nestedOnePhaseCommit, order, propagateOnAbort, 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
-
Field Details
-
MAX_OBJECT_SIZE
public static final int MAX_OBJECT_SIZE- See Also:
-
shadowMade
protected boolean shadowMade -
targetParticipantStore
-
topLevelState
-
classicPrepare
protected static final boolean classicPrepare
-
-
Constructor Details
-
PersistenceRecord
This constructor is used to create a new instance of PersistenceRecord. -
PersistenceRecord
public PersistenceRecord()Creates a 'blank' persistence record. This is used during crash recovery when recreating the prepared list of a server atomic action.
-
-
Method Details
-
typeIs
public int typeIs()Redefintions of abstract functions inherited from RecoveryRecord.- Overrides:
typeIs
in classRecoveryRecord
- Returns:
RecordType
value.
-
topLevelAbort
public int topLevelAbort()topLevelAbort may have to remove the persistent state that was written into the object store during the processing of topLevelPrepare. It then does the standard abort processing.- Overrides:
topLevelAbort
in classRecoveryRecord
- Returns:
TwoPhaseOutcome
to indicate success/failure.- See Also:
-
topLevelCommit
public int topLevelCommit()commit the state saved during the prepare phase.- Overrides:
topLevelCommit
in classRecoveryRecord
- Returns:
TwoPhaseOutcome
to indicate success/failure.- See Also:
-
topLevelPrepare
public int topLevelPrepare()topLevelPrepare attempts to save the object. It will either do this in the action intention list or directly in the object store by using the 'deactivate' function of the object depending upon the size of the state. To ensure that objects are correctly hidden while they are in an uncommitted state if we use the abbreviated protocol then we write an EMPTY object state as the shadow state - THIS MUST NOT BE COMMITTED. Instead we write_committed the one saved in the intention list. If the store cannot cope with being given an empty state we revert to the old protocol.- Overrides:
topLevelPrepare
in classRecoveryRecord
- Returns:
TwoPhaseOutcome
to indicate success/failure.- See Also:
-
topLevelCleanup
public int topLevelCleanup()topLevelCleanup must leave the persistent state that was written in the object store during the processing of topLevelPrepare intact. Crash recovery will take care of its resolution- Overrides:
topLevelCleanup
in classAbstractRecord
- Returns:
TwoPhaseOutcome
as default is the same as topLevelAbort.
-
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 classRecoveryRecord
- Returns:
true
-
restore_state
Description copied from class:AbstractRecord
During recovery, the transaction log is given to the recovery system and it will recreate a transaction instance to perform necessary recovery actions. This transaction will recreate the intentions list and give each recreated AbstractRecord the state that that was saved during transaction persistence. The base class will restore information that it needs from the log. Data items must be unpacked in the same order that they were packed.- Overrides:
restore_state
in classRecoveryRecord
- Returns:
true
if successful,false
otherwise.
-
save_state
Description copied from class:AbstractRecord
When the transaction is required to make the intentions list persistent, it scans the list and asks each record whether or not it requires state to be saved (by calling doSave). If the answer is yes, then save_state is called and the record instance must save enough information to enable it to be restored from that state later. The basic AbstractRecord save_state will save common data that is required by the base class during recovery. If a derived class calls super.save_state then it must be called before packing any other data item.- Overrides:
save_state
in classRecoveryRecord
- Returns:
true
if successful,false
otherwise.
-
print
Description copied from class:AbstractRecord
Write information about this specific instance to the specified stream.- Overrides:
print
in classRecoveryRecord
- 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 classRecoveryRecord
-
shadowForced
protected boolean shadowForced()Cadaver records force write shadows. This operation supresses to abbreviated commit This should never return false
-