public class BasicAction extends StateManager
Modifier and Type | Field and Description |
---|---|
protected RecordList |
failedList |
protected RecordList |
heuristicList |
protected RecordList |
pendingList |
protected RecordList |
preparedList |
protected RecordList |
readonlyList |
protected boolean |
savedIntentionList |
modifyingActions, objectModel, objectUid, usingActions
Modifier | Constructor and Description |
---|---|
|
BasicAction() |
protected |
BasicAction(int at)
Create a transaction of the specified type.
|
|
BasicAction(Uid objUid)
BasicAction constructor with a Uid.
|
protected |
BasicAction(Uid u,
int at)
Recreate the specified transaction.
|
Modifier and Type | Method and Description |
---|---|
protected int |
Abort()
This is the user callable abort operation.
|
protected int |
abortStatus() |
boolean |
activate()
Overloaded version of activate -- sets up the store, performs read_state
followed by restore_state.
|
boolean |
activate(String root)
Overloaded version of activate -- sets up the store, performs read_state
followed by restore_state.
|
int |
activeThreads() |
int |
add(AbstractRecord A)
Add a record to the atomic action.
|
boolean |
addChildAction(BasicAction act)
Add a new child action to the atomic action.
|
boolean |
addChildThread()
Add the current thread to the list of threads associated with this
transaction.
|
boolean |
addChildThread(Thread t)
Add the specified thread to the list of threads associated with this
transaction.
|
protected void |
addRecord(AbstractRecord A)
Add the specified abstract record to the transaction.
|
protected int |
async_prepare(boolean reportHeuristics) |
protected int |
Begin(BasicAction parentAct)
Atomic action Begin operation.
|
protected boolean |
checkForCurrent()
Do we want to check that a transaction can only be terminated by a thread
that has it as its current transaction? The base class has this check
enabled (i.e., we check), but some implementations may wish to override
this.
|
Object[] |
childTransactions() |
protected int |
commitStatus() |
protected void |
criticalEnd()
Defines the end of a critical region by resetting the critical flag.
|
protected void |
criticalStart()
Defines the start of a critical region by setting the critical flag.
|
static BasicAction |
Current() |
boolean |
deactivate()
Deprecated.
Only called in tests
|
boolean |
destroy()
Overloads
StateManager.destroy to prevent destroy being
called on a BasicAction. |
protected int |
doAbort(boolean reportHeuristics,
AbstractRecord record) |
protected int |
doAbort(RecordList list_toprocess,
boolean reportHeuristics) |
protected int |
doCommit(boolean reportHeuristics,
AbstractRecord record) |
protected int |
doCommit(RecordList rl,
boolean reportHeuristics)
Walk down a record list extracting records and calling the appropriate
commit function.
|
protected int |
doPrepare(boolean reportHeuristics,
AbstractRecord record) |
protected int |
End(boolean reportHeuristics)
End the atomic action by committing it.
|
boolean |
equals(Object obj) |
void |
finalizeInternal()
BasicAction destructor.
|
protected boolean |
forgetHeuristics()
Forget any heuristics we may have received, and tell the resources which
generated them to forget too.
|
protected int |
getHeuristicDecision() |
ActionHierarchy |
getHierarchy()
Return the action hierarchy for this transaction.
|
Uid |
getSavingUid() |
ParticipantStore |
getStore()
Set up an object store and assign it to the participantStore variable.
|
int |
hashCode() |
int |
hierarchyDepth() |
protected AbstractRecord |
insertRecord(RecordList reclist,
AbstractRecord record) |
boolean |
isAncestor(Uid ancestor)
boolean function that checks whether the Uid passed as an argument is the
Uid for an ancestor of the current atomic action.
|
static boolean |
maintainHeuristics()
If heuristic outcomes are returned, by default we will not save the state
once the forget method has been called on them (which happens as soon as
we have received all outcomes from registered resources).
|
protected void |
onePhaseCommit(boolean reportHeuristics)
There is only one record on the intentions list.
|
BasicAction |
parent() |
protected void |
phase2Abort(boolean reportHeuristics)
Second phase of the two phase commit protocol for aborting actions.
|
protected void |
phase2Cleanup()
Cleanup phase for actions.
|
protected void |
phase2Commit(boolean reportHeuristics)
Second phase of the two-phase commit protocol for committing actions.
|
protected int |
prepare(boolean reportHeuristics)
Phase one of a two phase commit protocol.
|
protected int |
preparedStatus() |
boolean |
preventCommit()
Force the only outcome for the transaction to be to rollback.
|
boolean |
removeChildAction(BasicAction act)
Remove a child action.
|
boolean |
removeChildThread()
Remove a child thread.
|
boolean |
removeChildThread(String threadId)
Remove the specified thread from the transaction.
|
boolean |
restore_state(InputObjectState os,
int ot)
This assumes the various lists are zero length when it is called.
|
boolean |
save_state(OutputObjectState os,
int ot)
Redefined version of save_state and restore_state from StateManager.
|
protected void |
setCheckedAction(CheckedAction c)
Add the specified CheckedAction object to this transaction.
|
protected void |
setHeuristicDecision(int p)
WARNING: use with extreme care!
|
int |
status() |
BasicAction |
topLevelAction() |
Uid |
topLevelActionUid()
The following function returns the Uid of the top-level atomic action.
|
String |
toString()
Overloads Object.toString()
|
String |
type()
Overloads StateManager.type()
|
int |
typeOfAction() |
protected void |
updateHeuristic(int p,
boolean commit) |
protected void |
updateState() |
cleanup, deactivate, deactivate, disable, forgetAction, get_uid, getMutex, getObjectModel, getStoreRoot, loadObjectState, lockMutex, modified, objectType, packHeader, persist, print, rememberAction, setStatus, setupStore, setupStore, setupStore, terminate, tryLockMutex, unlockMutex, unpackHeader
protected RecordList pendingList
protected RecordList preparedList
protected RecordList readonlyList
protected RecordList failedList
protected RecordList heuristicList
protected boolean savedIntentionList
public BasicAction()
public BasicAction(Uid objUid)
protected BasicAction(int at)
protected BasicAction(Uid u, int at)
public void finalizeInternal()
public final ActionHierarchy getHierarchy()
public final boolean preventCommit()
true
if successful, false
otherwise.public final int activeThreads()
public final int add(AbstractRecord A)
AddOutcome
indicating outcome.public final int hierarchyDepth()
public final boolean isAncestor(Uid ancestor)
true
if the parameter represents an ancestor,
false
otherwise.public final BasicAction parent()
public final int typeOfAction()
public final int status()
status
in class StateManager
public ParticipantStore getStore()
getStore
in class StateManager
ObjectStore
public final Uid topLevelActionUid()
Uid
.public final BasicAction topLevelAction()
public boolean activate()
null
.activate
in class StateManager
true
if successful, false
otherwise.ObjectStore
public boolean activate(String root)
root
parameter.activate
in class StateManager
true
if successful, false
otherwise.ObjectStore
public boolean deactivate()
null
. It is assumed that
this is being called during a transaction commit.deactivate
in class StateManager
true
on success, false
otherwise.public final boolean addChildThread()
true
if successful, false
otherwise.public final boolean addChildThread(Thread t)
true
if successful, false
otherwise.public final boolean removeChildThread()
true
if successful, false
otherwise.public final boolean removeChildThread(String threadId)
true
if successful, false
otherwise.public final boolean addChildAction(BasicAction act)
true
if successful, false
otherwise.public boolean save_state(OutputObjectState os, int ot)
save_state
in class StateManager
true
if successful, false
otherwise.public final boolean removeChildAction(BasicAction act)
true
if successful, false
otherwise.protected final void setCheckedAction(CheckedAction c)
CheckedAction
public Uid getSavingUid()
public boolean restore_state(InputObjectState os, int ot)
restore_state
in class StateManager
true
if successful, false
otherwise.public String type()
type
in class StateManager
public static BasicAction Current()
public static boolean maintainHeuristics()
true
if the transaction should save its heuristic
information, false
otherwise.public boolean destroy()
StateManager.destroy
to prevent destroy being
called on a BasicAction. Could be a *very* bad idea!!destroy
in class StateManager
false
.StateManager
public final Object[] childTransactions()
protected boolean forgetHeuristics()
true
if heuristic information (if any) was
successfully forgotten, false
otherwise.protected int Begin(BasicAction parentAct)
ActionStatus
indicating outcome.protected int End(boolean reportHeuristics)
true
.ActionStatus
indicating outcome.protected int Abort()
ActionStatus
indicating outcome.protected final void criticalStart()
protected final void criticalEnd()
protected final void phase2Cleanup()
protected final void phase2Commit(boolean reportHeuristics) throws Error
Error
- JBTM-895 tests, byteman limitationprotected final void phase2Abort(boolean reportHeuristics)
protected int async_prepare(boolean reportHeuristics)
protected final int prepare(boolean reportHeuristics)
TwoPhaseOutcome
indicating outcome.protected void onePhaseCommit(boolean reportHeuristics)
protected final int getHeuristicDecision()
protected final void setHeuristicDecision(int p)
protected final void addRecord(AbstractRecord A)
protected int preparedStatus()
protected int abortStatus()
protected int commitStatus()
protected int doPrepare(boolean reportHeuristics, AbstractRecord record)
protected int doCommit(RecordList rl, boolean reportHeuristics)
protected int doCommit(boolean reportHeuristics, AbstractRecord record)
protected int doAbort(RecordList list_toprocess, boolean reportHeuristics)
protected int doAbort(boolean reportHeuristics, AbstractRecord record)
protected AbstractRecord insertRecord(RecordList reclist, AbstractRecord record)
protected boolean checkForCurrent()
false
to disable checking.protected final void updateHeuristic(int p, boolean commit)
protected void updateState()
Copyright © 2012. All Rights Reserved.