|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.atomikos.icatch.imp.CoordinatorImp
public class CoordinatorImp
Implementation of termination logic.
Field Summary |
---|
Fields inherited from interface com.atomikos.icatch.Participant |
---|
READ_ONLY |
Constructor Summary | |
---|---|
|
CoordinatorImp()
No argument constructor as required by Recoverable interface. |
protected |
CoordinatorImp(String root,
boolean heuristic_commit,
Console console,
boolean checkorphans)
Constructor for testing only. |
|
CoordinatorImp(String root,
RecoveryCoordinator coord,
Console console,
boolean heuristic_commit,
boolean checkorphans)
Constructor. |
protected |
CoordinatorImp(String root,
RecoveryCoordinator coord,
Console console,
boolean heuristic_commit,
long timeout,
boolean checkorphans,
boolean single_threaded_2pc)
Constructor. |
Method Summary | |
---|---|
void |
addFSMEnterListener(FSMEnterListener l,
Object state)
|
void |
addFSMPreEnterListener(FSMPreEnterListener l,
Object state)
|
RecoveryCoordinator |
addParticipant(Participant participant)
|
void |
alarm(AlarmTimer timer)
Notify the instance of an alarm coming from a timer. |
HeuristicMessage[] |
commit(boolean onePhase)
Commit the participant's work. |
HeuristicMessage[] |
commitHeuristically()
|
protected void |
dispose()
For cleaning up properly. |
void |
forget()
Indicate that a heuristic participant can forget about its work. |
String |
getCoordinatorId()
Get the identifier for this coordinator. |
Object[] |
getFinalStates()
Needed by the Recovery system to determine when a logged state can be forgotten. |
HeuristicMessage[] |
getHeuristicMessages()
Get the heuristic info for the message round. |
HeuristicMessage[] |
getHeuristicMessages(Object heuristicState)
Gets the heuristic messages for all participants that are in the given heuristic state |
Object |
getId()
Get the id. |
ObjectImage |
getObjectImage()
Get an object image for this instance. |
ObjectImage |
getObjectImage(Object state)
Get an object image for the given state. |
Participant |
getParticipant()
|
Object[] |
getRecoverableStates()
Get the states that should be recoverable. |
RecoveryCoordinator |
getRecoveryCoordinator()
Get the recovery coordinator instance for this one. |
Object |
getState()
|
HeuristicMessage[] |
getTags()
Get the heuristic tags for this coordinator. |
protected long |
getTimeOut()
|
String |
getURI()
Gets a unique URI for this participant. |
protected void |
incLocalSiblingCount()
Called when a tx import is being done. |
boolean |
isCommitted()
Test if the transaction was committed or not. |
Boolean |
isRecoverableWhileActive()
Checks whether the instance is recoverable in the active state. |
void |
preEnter(FSMEnterEvent event)
Called BEFORE the FSM enters the new state, so that the callee is sure that nobody has seen the new state yet. |
int |
prepare()
Prepare the participant. |
boolean |
recover()
Recover this instance. |
Boolean |
replayCompletion(Participant participant)
Ask for a repetition of completion. |
protected void |
restore(ObjectImage image)
Help function for restoration. |
HeuristicMessage[] |
rollback()
Rollback the participant's work. |
HeuristicMessage[] |
rollbackHeuristically()
|
void |
setCascadeList(Dictionary allParticipants)
For cascading 2PC, this method sets the information needed to cascade. |
void |
setGlobalSiblingCount(int count)
Set by the root coordinator: the total no of siblings detected. |
void |
setRecoverableWhileActive()
Sets this coordinator to be recoverable while active. |
protected void |
startThreads(long timeout,
Console console)
Start threads, propagator and timer logic. |
protected void |
terminate(boolean commit)
Terminate the work, on behalf of Terminator. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected CoordinatorImp(String root, boolean heuristic_commit, Console console, boolean checkorphans)
protected CoordinatorImp(String root, RecoveryCoordinator coord, Console console, boolean heuristic_commit, long timeout, boolean checkorphans, boolean single_threaded_2pc)
root
- The root tid.coord
- The RecoverCoordinator, null if root.console
- The console to log to, or null if none.heuristic_commit
- Whether to do commit on heuristic.timeout
- The timeout in milliseconds for indoubts. before a heuristic
decision is made.checkorphans
- If true, orphan checks are made on prepare. For OTS, this is
false.single_threaded_2pc
- If true then commit is done in the same thread as the one that
started the tx.public CoordinatorImp(String root, RecoveryCoordinator coord, Console console, boolean heuristic_commit, boolean checkorphans)
root
- The root String for this one.console
- The console to log to, or null if none.coord
- The recovery coordinator for indoubt resolution.heuristic_commit
- If true, heuristic decision is commit.checkorphans
- If true, orphan checking is done at prepare.public CoordinatorImp()
Method Detail |
---|
public Boolean isRecoverableWhileActive()
CompositeCoordinator
isRecoverableWhileActive
in interface CompositeCoordinator
public HeuristicMessage[] getHeuristicMessages(Object heuristicState)
heuristicState
- The heuristic state, or the terminated state.
public boolean isCommitted()
public HeuristicMessage[] getHeuristicMessages()
getHeuristicMessages
in interface Participant
public HeuristicMessage[] getTags()
getTags
in interface CompositeCoordinator
protected void startThreads(long timeout, Console console)
timeout
- The timeout for the thread wakeup interval.console
- The console, null if none.protected long getTimeOut()
public Object getState()
getState
in interface Stateful
Stateful
public void addFSMEnterListener(FSMEnterListener l, Object state)
FSMEnterEventSource.
public void addFSMPreEnterListener(FSMPreEnterListener l, Object state)
addFSMPreEnterListener
in interface FSMPreEnterEventSource
public RecoveryCoordinator getRecoveryCoordinator()
CompositeCoordinator
getRecoveryCoordinator
in interface CompositeCoordinator
CompositeCoordinator.
public Participant getParticipant() throws UnsupportedOperationException
UnsupportedOperationException
CompositeCoordinator.
public String getCoordinatorId()
CompositeCoordinator
getCoordinatorId
in interface CompositeCoordinator
com.atomikos.icatch.CompositeCoordinator.
public RecoveryCoordinator addParticipant(Participant participant) throws SysException, IllegalStateException, RollbackException
SysException
IllegalStateException
RollbackException
protected void incLocalSiblingCount()
public void preEnter(FSMEnterEvent event) throws IllegalStateException
FSMPreEnterListener
preEnter
in interface FSMPreEnterListener
IllegalStateException
- on failure.
The callee can use this to prevent the state change from
happening.FSMPreEnterListener.
public String getURI()
Participant
getURI
in interface Participant
getURI
in interface RecoveryCoordinator
Participant
public boolean recover() throws SysException
Participant
recover
in interface Participant
SysException
- On failure.Participant
public void forget()
Participant
forget
in interface Participant
Participant.
public void setCascadeList(Dictionary allParticipants) throws SysException
Participant
setCascadeList
in interface Participant
allParticipants
- The information needed by
the transaction monitor for
SysException
- For unexpected failures.Participant.
public void setGlobalSiblingCount(int count)
Participant
setGlobalSiblingCount
in interface Participant
count
- The global count.Participant.
public int prepare() throws RollbackException, IllegalStateException, HeurHazardException, HeurMixedException, SysException
Participant
prepare
in interface Participant
RollbackException
- For a NO vote.
This indicates that the participant has already rolled back
(or marked for rollback) the work on behalf of this participant.
HeurHazardException
- On possible conflicts.
This happens for remote participants instances, in case of
communication failures.
HeurMixedException
- If some subordinate
participants voted YES, timed out and committed heuristically
whereas afterwards some NO votes where received.
SysException
- Unexpected errors.
IllegalStateException
Participant.
public HeuristicMessage[] commit(boolean onePhase) throws HeurRollbackException, HeurMixedException, HeurHazardException, IllegalStateException, RollbackException, SysException
Participant
commit
in interface Participant
onePhase
- If true, one-phase commit is being started.
If the participant has received a prepare call earlier,
then it should throw a SysException here.
HeurHazardException
- On possible conflicts.
RollbackException
- In case of one-phase commit,
and the transaction has been rolled back at the time
commit is called.
SysException
- Unexpected failure.
HeurRollbackException
HeurMixedException
IllegalStateException
Participant.
public HeuristicMessage[] rollback() throws HeurCommitException, HeurMixedException, SysException, HeurHazardException, IllegalStateException
Participant
rollback
in interface Participant
HeurCommitException
- If the participant committed.
HeurMixedException
- If part of it was rolled back.
SysException
- Unexpected failure.
HeurHazardException
- If the participant's final state
is unsure.
IllegalStateException
Participant.
public HeuristicMessage[] rollbackHeuristically() throws HeurCommitException, HeurMixedException, SysException, HeurHazardException, IllegalStateException
HeurCommitException
HeurMixedException
SysException
HeurHazardException
IllegalStateException
public HeuristicMessage[] commitHeuristically() throws HeurMixedException, SysException, HeurRollbackException, HeurHazardException, IllegalStateException, RollbackException
HeurMixedException
SysException
HeurRollbackException
HeurHazardException
IllegalStateException
RollbackException
public Boolean replayCompletion(Participant participant) throws IllegalStateException
RecoveryCoordinator
replayCompletion
in interface RecoveryCoordinator
participant
- The indoubt participant asking for replay
IllegalStateException
- If no prepare was done for the
participant asking the replay.RecoveryCoordinator.
protected void restore(ObjectImage image)
public ObjectImage getObjectImage()
Recoverable
getObjectImage
in interface Recoverable
Recoverable
public ObjectImage getObjectImage(Object state)
StateRecoverable
getObjectImage
in interface StateRecoverable
state
- The state about to be reached. Because the instance is not yet
IN the new state, this state is supplied as a parameter.
StateRecoverable
public Object[] getRecoverableStates()
StateRecoverable
getRecoverableStates
in interface StateRecoverable
StateRecoverable
public Object[] getFinalStates()
StateRecoverable
getFinalStates
in interface StateRecoverable
StateRecoverable
public Object getId()
Identifiable
getId
in interface Identifiable
Recoverable
public void alarm(AlarmTimer timer)
AlarmTimerListener
alarm
in interface AlarmTimerListener
timer
- The timer raising the alarm.protected void dispose()
protected void terminate(boolean commit) throws HeurRollbackException, HeurMixedException, SysException, SecurityException, HeurCommitException, HeurHazardException, RollbackException, IllegalStateException
commit
- True iff commit termination is asked.
HeurRollbackException
HeurMixedException
SysException
SecurityException
HeurCommitException
HeurHazardException
RollbackException
IllegalStateException
public void setRecoverableWhileActive() throws UnsupportedOperationException
CompositeCoordinator
setRecoverableWhileActive
in interface CompositeCoordinator
UnsupportedOperationException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |