// start messages
Enumeration enumm = participants.elements ();
while ( enumm.hasMoreElements () ) {
Participant p = (Participant) enumm.nextElement ();
if ( !readOnlyTable_.containsKey ( p ) ) {
RollbackMessage rm = new RollbackMessage ( p,
rollbackresult, indoubt );
propagator_.submitPropagationMessage ( rm );
// this will trigger sending the message
}
} // while
rollbackresult.waitForReplies ();
int res = rollbackresult.getResult ();
// check results, but we only care if we are indoubt.
// otherwise, we don't mind any remaining indoubts.
if ( indoubt && res != TerminationResult.ALL_OK ) {
if ( res == TerminationResult.HEUR_MIXED ) {
Hashtable hazards = rollbackresult.getPossiblyIndoubts ();
Hashtable heuristics = rollbackresult
.getHeuristicParticipants ();
addToHeuristicMap ( heuristics );
enumm = participants.elements ();
while ( enumm.hasMoreElements () ) {
Participant p = (Participant) enumm.nextElement ();
if ( !heuristics.containsKey ( p ) )
addToHeuristicMap ( p, TxState.TERMINATED );
}
nextStateHandler = new HeurMixedStateHandler ( this,
hazards );
coordinator_.setStateHandler ( nextStateHandler );
throw new HeurMixedException ( getHeuristicMessages () );
}
else if ( res == TerminationResult.HEUR_COMMIT ) {
nextStateHandler = new HeurCommittedStateHandler ( this );
coordinator_.setStateHandler ( nextStateHandler );
// NO extra per-participant state mappings, since ALL
// participants
// are heuristically committed.
throw new HeurCommitException ( getHeuristicMessages () );
}
else if ( res == TerminationResult.HEUR_HAZARD ) {
Hashtable hazards = rollbackresult.getPossiblyIndoubts ();
Hashtable heuristics = rollbackresult
.getHeuristicParticipants ();
// will trigger logging of indoubts and messages
addToHeuristicMap ( heuristics );
enumm = participants.elements ();
while ( enumm.hasMoreElements () ) {
Participant p = (Participant) enumm.nextElement ();
if ( !heuristics.containsKey ( p ) ) {
addToHeuristicMap ( p, TxState.TERMINATED );
}
}
nextStateHandler = new HeurHazardStateHandler ( this,