com.arjuna.ats.arjuna.coordinator
Class RecoveryAbstractRecord

java.lang.Object
  extended bycom.arjuna.ats.arjuna.StateManager
      extended bycom.arjuna.ats.arjuna.coordinator.AbstractRecord
          extended bycom.arjuna.ats.arjuna.coordinator.RecoveryAbstractRecord

public class RecoveryAbstractRecord
extends AbstractRecord

Abstract Record Interface Class. Used only for crash recovery. This interface allows us to use the Inventory for creating abstract records during crash recovery without having to make all abstract records accessible via interface/implementation separation (which affects the performance.) If performance issues can be ironed-out, then this may become obsolete in favour of a true AbstractRecord interface.

Since:
JTS 1.0.
Version:
$Id: RecoveryAbstractRecord.java 2342 2006-03-30 13:06:17Z nmcl $
Author:
Mark Little (mark@arjuna.com)

Field Summary
 
Fields inherited from class com.arjuna.ats.arjuna.StateManager
modifyingActions, objectName, objectUid, smAttributes, usingActions
 
Constructor Summary
RecoveryAbstractRecord(ClassName cName, int type, boolean doSave)
           
 
Method Summary
 void alter(AbstractRecord a)
          Alter the current record with the one presented.
 ClassName className()
          Only used for crash recovery, so most records don't need it.
 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.
 void finalize()
          Destructor.
 boolean forgetHeuristic()
          Forget any heuristic outcome which this implementation may have produced.
 java.lang.String getTypeOfObject()
          Return the type of the abstract record.
 void merge(AbstractRecord a)
          Merge the current record with the one presented.
 int nestedAbort()
          Atomic action interface - one operation per two-phase commit state.
 int nestedCommit()
          A commit of a nested transaction has occurred.
 int nestedPrepare()
          A prepare for a nested transaction has occurred.
 Uid order()
          Return the Uid of this abstract record so that it can be ordered in the intentions list.
 void print(java.io.PrintWriter strm)
          Write information about this specific instance to the specified stream.
 boolean propagateOnAbort()
          Determine if records are discarded on action abort or must be propagated to parents.
 boolean propagateOnCommit()
          Determine if records are discarded on action commit or must be propagated to parents.
 AbstractRecord record()
           
 boolean restore_state(InputObjectState os, int i)
          save_state and restore_state here are used by the corresponding operations of persistence records for crash recovery purposes.
 boolean save_state(OutputObjectState os, int i)
          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).
 void setValue(java.lang.Object o)
           
 boolean shouldAdd(AbstractRecord a)
          Should we add the record presented to the intentions list?
 boolean shouldAlter(AbstractRecord a)
          Should we alter the current record with the one presented?
 boolean shouldMerge(AbstractRecord a)
          Should we merge the current record with the one presented?
 boolean shouldReplace(AbstractRecord a)
          Should we replace the record presented with the current record?
 int topLevelAbort()
          A rollback of a top-level transaction has occurred.
 int topLevelCleanup()
          Cleanup is called if a top-level action is detected to be an orphan.
 int topLevelCommit()
          A commit of a top-level transaction has occurred.
 int topLevelPrepare()
          A prepare for a top-level transaction has occurred.
 java.lang.String type()
          Re-implementation of abstract methods inherited from base class
 int typeIs()
           
 java.lang.Object value()
          If this abstract record caused a heuristic then it should return an object which implements HeuristicInformation
 
Methods inherited from class com.arjuna.ats.arjuna.coordinator.AbstractRecord
create, equals, getNext, getPrevious, greaterThan, lessThan, nestedCleanup, nestedOnePhaseCommit, 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

RecoveryAbstractRecord

public RecoveryAbstractRecord(ClassName cName,
                              int type,
                              boolean doSave)
Method Detail

finalize

public void finalize()
Description copied from class: StateManager
Destructor.

Overrides:
finalize in class StateManager

typeIs

public int typeIs()
Specified by:
typeIs in class AbstractRecord
Returns:
RecordType value.

className

public ClassName className()
Description copied from class: AbstractRecord
Only used for crash recovery, so most records don't need it.

Overrides:
className in class AbstractRecord
Returns:
ClassName to identify this abstract record.

record

public AbstractRecord record()
Returns:
the actual AbstractRecord instance.

value

public java.lang.Object value()
Description copied from class: AbstractRecord
If this abstract record caused a heuristic then it should return an object which implements HeuristicInformation

Specified by:
value in class AbstractRecord
Returns:
Object to be used to order.

setValue

public void setValue(java.lang.Object o)
Specified by:
setValue in class AbstractRecord

nestedAbort

public int nestedAbort()
Atomic action interface - one operation per two-phase commit state.

Specified by:
nestedAbort in class AbstractRecord
Returns:
TwoPhaseOutcome to indicate success/failure.
See Also:
TwoPhaseOutcome

nestedCommit

public int nestedCommit()
Description copied from class: AbstractRecord
A commit of a nested transaction has occurred.

Specified by:
nestedCommit in class AbstractRecord
Returns:
TwoPhaseOutcome to indicate success/failure.
See Also:
TwoPhaseOutcome

nestedPrepare

public int nestedPrepare()
Description copied from class: AbstractRecord
A prepare for a nested transaction has occurred.

Specified by:
nestedPrepare in class AbstractRecord
Returns:
TwoPhaseOutcome to indicate success/failure.
See Also:
TwoPhaseOutcome

topLevelAbort

public int topLevelAbort()
Description copied from class: AbstractRecord
A rollback of a top-level transaction has occurred.

Specified by:
topLevelAbort in class AbstractRecord
Returns:
TwoPhaseOutcome to indicate success/failure.
See Also:
TwoPhaseOutcome

topLevelCommit

public int topLevelCommit()
Description copied from class: AbstractRecord
A commit of a top-level transaction has occurred.

Specified by:
topLevelCommit in class AbstractRecord
Returns:
TwoPhaseOutcome to indicate success/failure.
See Also:
TwoPhaseOutcome

topLevelPrepare

public int topLevelPrepare()
Description copied from class: AbstractRecord
A prepare for a top-level transaction has occurred.

Specified by:
topLevelPrepare in class AbstractRecord
Returns:
TwoPhaseOutcome to indicate success/failure.
See Also:
TwoPhaseOutcome

order

public Uid 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 class AbstractRecord
Returns:
Uid for this instance.
See Also:
Uid

getTypeOfObject

public java.lang.String getTypeOfObject()
Description copied from class: AbstractRecord
Return the type of the abstract record. Used in ordering the instances in the intentions list. This is also the type that the record was saved with in the object store.

Overrides:
getTypeOfObject in class AbstractRecord
Returns:
String representing type.

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 class AbstractRecord
Returns:
whether or not records are discarded on action abort or must be propagated to parents

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 class AbstractRecord
Returns:
whether or not records are discarded on action commit or must be propagated to parents

topLevelCleanup

public int topLevelCleanup()
Cleanup is called if a top-level action is detected to be an orphan. NOTE nested actions are never orphans since their parents would be aborted we may as well abort them as well.

Overrides:
topLevelCleanup in class AbstractRecord
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 class AbstractRecord
Returns:
true if it should be saved, false otherwise. false is the default.

type

public java.lang.String type()
Re-implementation of abstract methods inherited from base class

Overrides:
type in class AbstractRecord

print

public void print(java.io.PrintWriter strm)
Description copied from class: AbstractRecord
Write information about this specific instance to the specified stream.

Overrides:
print in class AbstractRecord

restore_state

public boolean restore_state(InputObjectState os,
                             int i)
save_state and restore_state here are used by the corresponding operations of persistence records for crash recovery purposes.

Overrides:
restore_state in class AbstractRecord
Returns:
true if successful, false otherwise.

save_state

public boolean save_state(OutputObjectState os,
                          int i)
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.

Overrides:
save_state in class AbstractRecord
Returns:
true if successful, false otherwise.

forgetHeuristic

public boolean forgetHeuristic()
Description copied from class: AbstractRecord
Forget any heuristic outcome which this implementation may have produced.

Overrides:
forgetHeuristic in class AbstractRecord
Returns:
true by default. If false 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.

merge

public void merge(AbstractRecord a)
Description copied from class: AbstractRecord
Merge the current record with the one presented.

Specified by:
merge in class AbstractRecord

alter

public void alter(AbstractRecord a)
Description copied from class: AbstractRecord
Alter the current record with the one presented.

Specified by:
alter in class AbstractRecord

shouldAdd

public boolean shouldAdd(AbstractRecord a)
Description copied from class: AbstractRecord
Should we add the record presented to the intentions list?

Specified by:
shouldAdd in class AbstractRecord
Returns:
true if the record should be added, false otherwise.

shouldAlter

public boolean shouldAlter(AbstractRecord a)
Description copied from class: AbstractRecord
Should we alter the current record with the one presented?

Specified by:
shouldAlter in class AbstractRecord
Returns:
true if the record should be altered, false otherwise.

shouldMerge

public boolean shouldMerge(AbstractRecord a)
Description copied from class: AbstractRecord
Should we merge the current record with the one presented?

Specified by:
shouldMerge in class AbstractRecord
Returns:
true if the record should be merged, false otherwise.

shouldReplace

public boolean shouldReplace(AbstractRecord a)
Description copied from class: AbstractRecord
Should we replace the record presented with the current record?

Specified by:
shouldReplace in class AbstractRecord
Returns:
true if the record should be replaced, false otherwise.