Class 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 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)
  • Constructor Details

    • CadaverRecord

      public CadaverRecord(OutputObjectState os, ParticipantStore participantStore, StateManager sm)
      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 class AbstractRecord
      Returns:
      true
    • typeIs

      public int typeIs()
      The type of the record.
      Overrides:
      typeIs in class PersistenceRecord
      Returns:
      RecordType.PERSISTENT
      See Also:
    • nestedAbort

      public int nestedAbort()
      The nested transaction has aborted. The record will invalidate any new state.
      Overrides:
      nestedAbort in class RecoveryRecord
      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 class RecoveryRecord
      Returns:
      TwoPhaseOutcome to indicate success/failure.
      See Also:
    • topLevelAbort

      public int topLevelAbort()
      The nested transaction has aborted. Invalidate any new state.
      Overrides:
      topLevelAbort in class PersistenceRecord
      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 class PersistenceRecord
      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 class PersistenceRecord
      Returns:
      TwoPhaseOutcome to indicate success/failure.
      See Also:
    • print

      public void print(PrintWriter strm)
      Override AbstractRecord.print to write specific information to the specified stream.
      Overrides:
      print in class PersistenceRecord
      Parameters:
      strm - the stream to use.
    • type

      public String type()
      The type of the class - may be used to save information in an hierarchical manner in the object participantStore.
      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:
    • 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.
      Overrides:
      merge in class RecoveryRecord
      Parameters:
      mergewith - The record to merge with.
    • shouldMerge

      public boolean shouldMerge(AbstractRecord ar)
      Overrides AbstractRecord.shouldMerge
      Overrides:
      shouldMerge in class RecoveryRecord
      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

      public boolean shouldReplace(AbstractRecord ar)
      Overrides AbstractRecord.shouldReplace
      Overrides:
      shouldReplace in class RecoveryRecord
      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: