com.arjuna.ats.arjuna
Class CadaverRecord

java.lang.Object
  extended bycom.arjuna.ats.arjuna.StateManager
      extended bycom.arjuna.ats.arjuna.coordinator.AbstractRecord
          extended bycom.arjuna.ats.arjuna.RecoveryRecord
              extended bycom.arjuna.ats.arjuna.PersistenceRecord
                  extended bycom.arjuna.ats.arjuna.CadaverRecord
Direct Known Subclasses:
DisposeRecord

public class CadaverRecord
extends PersistenceRecord

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 store. 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.arjuna.PersistenceRecord
classicPrepare, MAX_OBJECT_SIZE, objectAddr, shadowMade, state, topLevelState
 
Fields inherited from class com.arjuna.ats.arjuna.StateManager
modifyingActions, objectName, objectUid, smAttributes, usingActions
 
Constructor Summary
protected CadaverRecord()
          Create a new instance using default values.
  CadaverRecord(OutputObjectState os, ObjectStore objStore, StateManager sm)
          Create a new instance, passing in the object that is being managed.
 
Method Summary
 ClassName className()
          The ClassName representation of this class.
static AbstractRecord create()
          Create a new instance of the CadaverRecord, using the default constructor.
 boolean doSave()
          Override the AbstractRecord.doSave.
 void finalize()
          Tidy-up the instance.
 void merge(AbstractRecord mergewith)
          merge takes the information from the incoming PersistenceRecord and uses it to initialise the oldState information.
 int nestedAbort()
          The nested transaction has aborted.
 int nestedPrepare()
          The nested transaction is preparing.
 void print(java.io.PrintWriter strm)
          Override AbstractRecord.print to write specific information to the specified stream.
 boolean propagateOnAbort()
          Override default AbstractRecord method.
 boolean shouldMerge(AbstractRecord ar)
          Overrides AbstractRecord.shouldMerge
 boolean shouldReplace(AbstractRecord ar)
          Overrides AbstractRecord.shouldReplace
 int topLevelAbort()
          The nested transaction has aborted.
 int topLevelCommit()
          At topLevelCommit we commit the uncommitted version already saved into object store.
 int topLevelPrepare()
          At topLevelPrepare write uncommitted version into object store.
 java.lang.String type()
          The type of the class - may be used to save information in an hierarchical manner in the object store.
 int typeIs()
          The type of the record.
 
Methods inherited from class com.arjuna.ats.arjuna.PersistenceRecord
alter, forgetAction, nestedCommit, restore_state, save_state, setValue, shadowForced, shouldAdd, shouldAlter, topLevelCleanup, value
 
Methods inherited from class com.arjuna.ats.arjuna.coordinator.AbstractRecord
create, equals, forgetHeuristic, getNext, getPrevious, getTypeOfObject, greaterThan, lessThan, nestedCleanup, nestedOnePhaseCommit, order, propagateOnCommit, replace, setNext, setPrevious, topLevelOnePhaseCommit
 
Methods inherited from class com.arjuna.ats.arjuna.StateManager
activate, activate, attributes, cleanup, deactivate, deactivate, deactivate, destroy, disable, forgetAction, get_uid, getMutex, getStore, getStoreRoot, loadObjectState, lockMutex, modified, ObjectType, packHeader, persist, rememberAction, setStatus, setupStore, setupStore, status, terminate, tryLockMutex, unlockMutex, unpackHeader
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CadaverRecord

public CadaverRecord(OutputObjectState os,
                     ObjectStore objStore,
                     StateManager sm)
Create a new instance, passing in the object that is being managed.


CadaverRecord

protected CadaverRecord()
Create a new instance using default values. Typically used during failure recovery.

Method Detail

finalize

public void finalize()
Tidy-up the instance.

Overrides:
finalize in class PersistenceRecord

propagateOnAbort

public boolean propagateOnAbort()
Override default AbstractRecord method. CadaverRecords are propagated regardless of the termination condition.

Overrides:
propagateOnAbort in class AbstractRecord
Returns:
true

typeIs

public int typeIs()
The type of the record.

Overrides:
typeIs in class PersistenceRecord
Returns:
RecordType.PERSISTENT
See Also:
RecordType

className

public ClassName className()
The ClassName representation of this class.

Overrides:
className in class PersistenceRecord

nestedAbort

public int nestedAbort()
The nested transaction has aborted. The record will invalidate any new state.


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.


topLevelAbort

public int topLevelAbort()
The nested transaction has aborted. Invalidate any new state.

Overrides:
topLevelAbort in class PersistenceRecord

topLevelCommit

public int topLevelCommit()
At topLevelCommit we commit the uncommitted version already saved into object store. Cannot use inherited version since that assumes object is alive instead talk directly to the object store itself.

Overrides:
topLevelCommit in class PersistenceRecord

topLevelPrepare

public int topLevelPrepare()
At topLevelPrepare write uncommitted version into object store. Cannot use inherited version since that assumes object is alive instead talk directly to the object store itself.

Overrides:
topLevelPrepare in class PersistenceRecord

print

public void print(java.io.PrintWriter strm)
Override AbstractRecord.print to write specific information to the specified stream.

Overrides:
print in class PersistenceRecord

type

public java.lang.String type()
The type of the class - may be used to save information in an hierarchical manner in the object store.

Overrides:
type in class PersistenceRecord

doSave

public boolean doSave()
Override the AbstractRecord.doSave.

Overrides:
doSave in class PersistenceRecord
Returns:
true if the object being removed is a persistent object (RecordType.PERSISTENT). false otherwise.
See Also:
RecordType

create

public static AbstractRecord create()
Create a new instance of the CadaverRecord, using the default constructor. Have to return as a AbstractStore because of inheritence.

Returns:
a new CadaverRecord.

merge

public void merge(AbstractRecord mergewith)
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.


shouldMerge

public boolean shouldMerge(AbstractRecord ar)
Overrides AbstractRecord.shouldMerge

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:
RecordType

shouldReplace

public boolean shouldReplace(AbstractRecord ar)
Overrides AbstractRecord.shouldReplace

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:
RecordType