protected void commitFromWithinCallback(boolean heuristic,boolean onePhase) throws HeurRollbackException, HeurMixedException, HeurHazardException, java.lang.IllegalStateException, RollbackException, SysException {
  CoordinatorStateHandler nextStateHandler=null;
  try {
    Vector<Participant> participants=coordinator_.getParticipants();
    int count=(participants.size() - readOnlyTable_.size());
    TerminationResult commitresult=new TerminationResult(count);
    committed_=Boolean.TRUE;
    try {
      coordinator_.setState(TxState.COMMITTING);
    }
 catch (    RuntimeException error) {
      String msg="Error in committing: " + error.getMessage() + " - recovery will clean up in the background";
      LOGGER.logWarning(msg,error);
      throw new RollbackException(msg,error);
    }
    Enumeration<Participant> enumm=participants.elements();
    while (enumm.hasMoreElements()) {
      Participant p=enumm.nextElement();
      if (!readOnlyTable_.contains(p)) {
        CommitMessage cm=new CommitMessage(p,commitresult,onePhase);
        if (onePhase && cascadeList_ != null) {
          Integer sibnum=cascadeList_.get(p);
          if (sibnum != null)           p.setGlobalSiblingCount(sibnum.intValue());
          p.setCascadeList(cascadeList_);
        }
        propagator_.submitPropagationMessage(cm);
      }
    }
    commitresult.waitForReplies();
    int res=commitresult.getResult();
    if (res != TerminationResult.ALL_OK) {
      if (res == TerminationResult.HEUR_MIXED) {
        Set<Participant> hazards=commitresult.getPossiblyIndoubts();
        nextStateHandler=new HeurMixedStateHandler(this,hazards);
        coordinator_.setStateHandler(nextStateHandler);
        throw new HeurMixedException();
      }
 else       if (res == TerminationResult.ROLLBACK) {
        nextStateHandler=new TerminatedStateHandler(this);
        coordinator_.setStateHandler(nextStateHandler);
        throw new RollbackException("Rolled back already.");
      }
 else       if (res == TerminationResult.HEUR_ROLLBACK) {
        nextStateHandler=new HeurAbortedStateHandler(this);
        coordinator_.setStateHandler(nextStateHandler);
        throw new HeurRollbackException();
      }
 else       if (res == TerminationResult.HEUR_HAZARD) {
        Set<Participant> hazards=commitresult.getPossiblyIndoubts();
        nextStateHandler=new HeurHazardStateHandler(this,hazards);
        coordinator_.setStateHandler(nextStateHandler);
        throw new HeurHazardException();
      }
    }
 else {
      if (heuristic) {
        nextStateHandler=new HeurCommittedStateHandler(this);
      }
 else       nextStateHandler=new TerminatedStateHandler(this);
      coordinator_.setStateHandler(nextStateHandler);
    }
  }
 catch (  RuntimeException runerr) {
    throw new SysException("Error in commit: " + runerr.getMessage(),runerr);
  }
catch (  InterruptedException intr) {
    InterruptedExceptionHelper.handleInterruptedException(intr);
    throw new SysException("Error in commit" + intr.getMessage(),intr);
  }
}

protected void commitFromWithinCallback ( boolean heuristic , boolean onePhase ) throws HeurRollbackException , HeurMixedException , HeurHazardException , java . lang . IllegalStateException , RollbackException , SysException { CoordinatorStateHandler nextStateHandler = null ; try { Vector < Participant > participants = coordinator_ . getParticipants ( ) ; int count = ( participants . size ( ) - readOnlyTable_ . size ( ) ) ; TerminationResult commitresult = new TerminationResult ( count ) ; committed_ = Boolean . TRUE ; try { coordinator_ . setState ( TxState . COMMITTING ) ; } catch ( RuntimeException error ) { String msg = "Error in committing: " + error . getMessage ( ) + " - recovery will clean up in the background" ; LOGGER . logWarning ( msg , error ) ; throw new RollbackException ( msg , error ) ; } Enumeration < Participant > enumm = participants . elements ( ) ; while ( enumm . hasMoreElements ( ) ) { Participant p = enumm . nextElement ( ) ; if ( ! readOnlyTable_ . contains ( p ) ) { CommitMessage cm = new CommitMessage ( p , commitresult , onePhase ) ; if ( onePhase && cascadeList_ != null ) { Integer sibnum = cascadeList_ . get ( p ) ; if ( sibnum != null ) p . setGlobalSiblingCount ( sibnum . intValue ( ) ) ; p . setCascadeList ( cascadeList_ ) ; } propagator_ . submitPropagationMessage ( cm ) ; } } commitresult . waitForReplies ( ) ; int res = commitresult . getResult ( ) ; if ( res != TerminationResult . ALL_OK ) { if ( res == TerminationResult . HEUR_MIXED ) { Set < Participant > hazards = commitresult . getPossiblyIndoubts ( ) ; nextStateHandler = new HeurMixedStateHandler ( this , hazards ) ; coordinator_ . setStateHandler ( nextStateHandler ) ; throw new HeurMixedException ( ) ; } else if ( res == TerminationResult . ROLLBACK ) { nextStateHandler = new TerminatedStateHandler ( this ) ; coordinator_ . setStateHandler ( nextStateHandler ) ; throw new RollbackException ( "Rolled back already." ) ; } else if ( res == TerminationResult . HEUR_ROLLBACK ) { nextStateHandler = new HeurAbortedStateHandler ( this ) ; coordinator_ . setStateHandler ( nextStateHandler ) ; throw new HeurRollbackException ( ) ; } else if ( res == TerminationResult . HEUR_HAZARD ) { Set < Participant > hazards = commitresult . getPossiblyIndoubts ( ) ; nextStateHandler = new HeurHazardStateHandler ( this , hazards ) ; coordinator_ . setStateHandler ( nextStateHandler ) ; throw new HeurHazardException ( ) ; } } else { if ( heuristic ) { nextStateHandler = new HeurCommittedStateHandler ( this ) ; } else nextStateHandler = new TerminatedStateHandler ( this ) ; coordinator_ . setStateHandler ( nextStateHandler ) ; } } catch ( RuntimeException runerr ) { throw new SysException ( "Error in commit: " + runerr . getMessage ( ) , runerr ) ; } catch ( InterruptedException intr ) { InterruptedExceptionHelper . handleInterruptedException ( intr ) ; throw new SysException ( "Error in commit" + intr . getMessage ( ) , intr ) ; } }
auxiliary method for committing . this method can be reused in subclasses in order to process commit .
