com.arjuna.ats.arjuna
Class LastResourceRecord

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

public class LastResourceRecord
extends AbstractRecord

AbstractRecord that helps us do the last resource commit optimization. Basically this is something that is used to allow a *single* resource that is only one-phase aware to be enlisted with a transaction that is usually two-phase. The way it works is: (i) the coordinator runs its normal first (prepare) phase on all two-phase aware participants and makes a decision based solely on their responses as to whether to commit or roll back. Note, the one-phase aware resource essentially returns voteCommit during prepare, to ensure that the second phase runs even if all other resources return voteReadOnly. (ii) if the transaction is to commit then the coordinator invokes the second phase on *all* participants, starting with the one that is only one-phase aware. If it rolls back, it rolls all resources back, but the order is not important.

Since:
ATS 3.2.
Version:
$Id: LastResourceRecord.java 2342 2006-03-30 13:06:17Z $
Author:
Mark Little (mark@arjuna.com)

Field Summary
 
Fields inherited from class com.arjuna.ats.arjuna.StateManager
modifyingActions, objectName, objectUid, smAttributes, usingActions
 
Constructor Summary
protected LastResourceRecord()
           
  LastResourceRecord(OnePhaseResource opr)
           
 
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.
static AbstractRecord create()
           
 void merge(AbstractRecord a)
          Merge the current record with the one presented.
 int nestedAbort()
          A rollback of a nested transaction has occurred.
 int nestedCommit()
          A commit of a nested transaction has occurred.
 int nestedPrepare()
          Not allowed to participate in nested transactions.
 void print(java.io.PrintWriter strm)
          Write information about this specific instance to the specified stream.
 boolean propagateOnCommit()
          Determine if records are discarded on action commit or must be propagated to parents.
 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 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, doSave, equals, forgetHeuristic, getNext, getPrevious, getTypeOfObject, greaterThan, lessThan, nestedCleanup, nestedOnePhaseCommit, order, propagateOnAbort, replace, restore_state, save_state, setNext, setPrevious, topLevelCleanup, topLevelOnePhaseCommit
 
Methods inherited from class com.arjuna.ats.arjuna.StateManager
activate, activate, attributes, cleanup, deactivate, deactivate, deactivate, destroy, disable, finalize, 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

LastResourceRecord

public LastResourceRecord(OnePhaseResource opr)

LastResourceRecord

protected LastResourceRecord()
Method Detail

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:
true if the record should be propagated to the parent transaction if the current transaction commits, false otherwise. The default is true.

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.

nestedAbort

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

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()
Not allowed to participate in nested transactions.

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

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

type

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

Overrides:
type 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.

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.

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.

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

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

create

public static AbstractRecord create()