Ejemplo n.º 1
0
  private PsmInterp makeStateMachine(final UserData ud) {
    PsmMachine machine = makeMachine();
    PsmInterp interp = newPsmInterp(machine, ud);
    interp.setName("ReusableRepairer");
    interp.setCheckpointer(
        new PsmInterp.Checkpointer() {
          public void checkpoint(PsmInterpStateBean resumeStateBean) {
            // Throw an error?
          }
        });

    return interp;
  }
Ejemplo n.º 2
0
 private void startStateMachine() {
   // start the state machine running.
   String msg = "Error starting V3ReusableRepairer";
   try {
     stateMachine.enqueueStart(ehAbortPoll(msg));
   } catch (PsmException e) {
     log.warning(msg, e);
     abort();
   }
 }
Ejemplo n.º 3
0
 /** Handle an incoming V3LcapMessage. */
 public void receiveMessage(LcapMessage message) {
   final V3LcapMessage msg = (V3LcapMessage) message;
   PeerIdentity sender = msg.getOriginatorId();
   PsmMsgEvent evt = V3Events.fromMessage(msg);
   log.debug3("Received message: " + message.getOpcodeString() + " " + message);
   String errmsg = "State machine error";
   stateMachine.enqueueEvent(
       evt,
       ehAbortPoll(errmsg),
       new PsmInterp.Action() {
         public void eval() {
           msg.delete();
         }
       });
   // Finally, clean up after the V3LcapMessage
   // todo(bhayes): Really? And "finally" rather than "try/finally?"
   msg.delete();
 }
Ejemplo n.º 4
0
 private PsmInterp newPsmInterp(PsmMachine stateMachine, UserData userData) {
   PsmManager mgr = daemon.getPsmManager();
   PsmInterp interp = mgr.newPsmInterp(stateMachine, userData);
   interp.setThreaded(true);
   return interp;
 }