|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.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,
boolean checkorphans)
Constructor for testing only. |
|
CoordinatorImp(String root,
RecoveryCoordinator coord,
boolean heuristic_commit,
boolean checkorphans)
Constructor. |
protected |
CoordinatorImp(String root,
RecoveryCoordinator coord,
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)
Commits the participant's work. |
HeuristicMessage[] |
commitHeuristically()
|
protected void |
dispose()
For cleaning up properly. |
void |
forget()
Indicates that a heuristic participant can forget about its work. |
String |
getCoordinatorId()
|
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()
|
Object |
getState()
|
HeuristicMessage[] |
getTags()
Get the heuristic tags for this coordinator. |
protected long |
getTimeOut()
|
String |
getURI()
Gets the URI identifier for this coordinator. |
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()
Prepares the participant. |
boolean |
recover()
Called by the transaction manager (TM) at recovery time, and this should reconstruct the internal state. |
Boolean |
replayCompletion(Participant participant)
Asks for a repetition of completion. |
protected void |
restore(ObjectImage image)
Help function for restoration. |
HeuristicMessage[] |
rollback()
Rollback of 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)
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,
boolean checkorphans)
protected CoordinatorImp(String root,
RecoveryCoordinator coord,
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,
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 CompositeCoordinatorpublic HeuristicMessage[] getHeuristicMessages(Object heuristicState)
heuristicState - The heuristic state, or the terminated state.
public boolean isCommitted()
public HeuristicMessage[] getHeuristicMessages()
getHeuristicMessages in interface Participantpublic HeuristicMessage[] getTags()
getTags in interface CompositeCoordinatorprotected void startThreads(long timeout)
timeout - The timeout for the thread wakeup interval.console - The console, null if none.protected long getTimeOut()
public Object getState()
getState in interface StatefulStateful
public void addFSMEnterListener(FSMEnterListener l,
Object state)
FSMEnterEventSource.
public void addFSMPreEnterListener(FSMPreEnterListener l,
Object state)
addFSMPreEnterListener in interface FSMPreEnterEventSourcepublic RecoveryCoordinator getRecoveryCoordinator()
getRecoveryCoordinator in interface CompositeCoordinatorCompositeCoordinator.
public Participant getParticipant()
throws UnsupportedOperationException
UnsupportedOperationExceptionCompositeCoordinator.public String getCoordinatorId()
getCoordinatorId in interface CompositeCoordinatorcom.atomikos.icatch.CompositeCoordinator.
public RecoveryCoordinator addParticipant(Participant participant)
throws SysException,
IllegalStateException,
RollbackException
SysException
IllegalStateException
RollbackExceptionprotected void incLocalSiblingCount()
public void preEnter(FSMEnterEvent event)
throws IllegalStateException
FSMPreEnterListener
preEnter in interface FSMPreEnterListenerIllegalStateException - on failure.
The callee can use this to prevent the state change from
happening.FSMPreEnterListener.public String getURI()
RecoveryCoordinator
getURI in interface ParticipantgetURI in interface RecoveryCoordinatorParticipant
public boolean recover()
throws SysException
Participant
recover in interface ParticipantSysExceptionParticipantpublic void forget()
Participant
forget in interface ParticipantParticipant.
public void setCascadeList(Dictionary allParticipants)
throws SysException
Participant
setCascadeList in interface ParticipantallParticipants - The information needed by
the transaction monitor.
SysExceptionParticipant.public void setGlobalSiblingCount(int count)
Participant
setGlobalSiblingCount in interface Participantcount - The global count.Participant.
public int prepare()
throws RollbackException,
IllegalStateException,
HeurHazardException,
HeurMixedException,
SysException
Participant
prepare in interface ParticipantRollbackException - 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
IllegalStateExceptionParticipant.
public HeuristicMessage[] commit(boolean onePhase)
throws HeurRollbackException,
HeurMixedException,
HeurHazardException,
IllegalStateException,
RollbackException,
SysException
Participant
commit in interface ParticipantonePhase - 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
HeurRollbackException
HeurMixedException
IllegalStateExceptionParticipant.
public HeuristicMessage[] rollback()
throws HeurCommitException,
HeurMixedException,
SysException,
HeurHazardException,
IllegalStateException
Participant
rollback in interface ParticipantHeurCommitException - If the participant committed.
HeurMixedException - If part of the work was rolled back.
SysException
HeurHazardException - If the participant's final state
is unsure.
IllegalStateExceptionParticipant.
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 RecoveryCoordinatorparticipant - 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 RecoverableRecoverablepublic ObjectImage getObjectImage(Object state)
StateRecoverable
getObjectImage in interface StateRecoverablestate - The state about to be reached. Because the instance is not yet
IN the new state, this state is supplied as a parameter.
StateRecoverablepublic Object[] getRecoverableStates()
StateRecoverable
getRecoverableStates in interface StateRecoverableStateRecoverablepublic Object[] getFinalStates()
StateRecoverable
getFinalStates in interface StateRecoverableStateRecoverablepublic Object getId()
Identifiable
getId in interface IdentifiableRecoverablepublic void alarm(AlarmTimer timer)
AlarmTimerListener
alarm in interface AlarmTimerListenertimer - 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 CompositeCoordinatorUnsupportedOperationException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||