예제 #1
0
 /**
  * This is the protocol's main event handler. It accepts the following events:
  *
  * <ul>
  *   <li>net.sf.appia.protocols.group.leave.LeaveEvent
  *   <li>net.sf.appia.protocols.group.events.GroupSendableEvent
  *   <li>net.sf.appia.protocols.group.intra.View
  * </ul>
  *
  * @param event the event to handle.
  * @see net.sf.appia.core.Session#handle(net.sf.appia.core.Event)
  */
 public void handle(Event event) {
   if (event instanceof View) handleView((View) event);
   else if (event instanceof LeaveEvent) handleLeaveEvent((LeaveEvent) event);
   else if (event instanceof GroupSendableEvent)
     handleGroupSendableEvent((GroupSendableEvent) event);
   else
     try {
       event.go();
     } catch (AppiaEventException e) {
       e.printStackTrace();
     }
 }
예제 #2
0
  /** Event handler. */
  public void handle(Event event) {

    // Suspect
    if (event instanceof Suspect) {
      handleSuspect((Suspect) event);
      return;
      // GroupSendableEvent
    } else if (event instanceof GroupSendableEvent) {
      handleGroupSendableEvent((GroupSendableEvent) event);
      return;
      // SuspectTimer
    } else if (event instanceof SuspectTimer) {
      handleSuspectTimer((SuspectTimer) event);
      return;
      // View
    } else if (event instanceof View) {
      handleView((View) event);
      return;
      // FIFOUndeliveredEvent
    } else if (event instanceof FIFOUndeliveredEvent) {
      handleFIFOUndeliveredEvent((FIFOUndeliveredEvent) event);
      return;
      // TcpUndeliveredEvent
    } else if (event instanceof TcpUndeliveredEvent) {
      handleTcpUndeliveredEvent((TcpUndeliveredEvent) event);
      return;
    } else if (event instanceof ChannelInit) {
      handleChannelInit((ChannelInit) event);
      return;
    }

    log.warn("Unwanted event (\"" + event.getClass().getName() + "\") received. Continued...");
    try {
      event.go();
    } catch (AppiaEventException ex) {
      ex.printStackTrace();
    }
  }
예제 #3
0
 public void handle(Event e) {
   if (e instanceof GroupSendableEvent) handleGroupSendable((GroupSendableEvent) e);
   else if (e instanceof EchoEvent) handleEchoEvent((EchoEvent) e);
   else if (e instanceof View) handleView((View) e);
   else if (e instanceof BlockOk) handleBlockOk((BlockOk) e);
   else if (e instanceof ChannelInit) handleChannelInit((ChannelInit) e);
   else if (e instanceof ChannelClose) handleChannelClose((ChannelClose) e);
   else
     try {
       e.go();
     } catch (AppiaEventException e1) {
       e1.printStackTrace();
     }
 }
예제 #4
0
 /**
  * Handles all received event
  *
  * @param ev
  */
 public void handle(Event ev) {
   if (ev instanceof TextEvent
       || ev instanceof DrawEvent
       || ev instanceof ImageEvent
       || ev instanceof ClearWhiteBoardEvent
       || ev instanceof MouseButtonEvent) handleInterestingEvent((GroupSendableEvent) ev);
   else {
     try {
       ev.go();
     } catch (AppiaEventException ex) {
       ex.printStackTrace();
     }
   }
 }
  public void handle(Event event) {

    if (event instanceof ChannelInit) handleChannelInit((ChannelInit) event);
    else if (event instanceof ProcessInitEvent) handleProcessInit((ProcessInitEvent) event);
    else if (event instanceof Crash) handleCrash((Crash) event);
    else if (event instanceof SharedRead) handleSharedRead((SharedRead) event);
    else if (event instanceof SharedWrite) handleSharedWrite((SharedWrite) event);
    else if (event instanceof WriteEvent) handleWriteEvent((WriteEvent) event);
    else if (event instanceof AckEvent) handleAckEvent((AckEvent) event);
    else {
      debug("Unwanted event received (\"" + event + "\"), ignoring.");
      try {
        event.go();
      } catch (AppiaEventException ex) {
        ex.printStackTrace();
      }
    }
  }
예제 #6
0
 /**
  * Main handler of events.
  *
  * @see net.sf.appia.core.Session#handle(Event)
  */
 public void handle(Event event) {
   if (event instanceof ChannelInit) handleChannelInit((ChannelInit) event);
   else if (event instanceof ChannelClose) handleChannelClose((ChannelClose) event);
   else if (event instanceof BlockOk) handleBlockOk((BlockOk) event);
   else if (event instanceof View) handleNewView((View) event);
   else if (event instanceof AckViewEvent) handleAckViewEvent((AckViewEvent) event);
   else if (event instanceof SETOTimer) handleTimer((SETOTimer) event);
   else if (event instanceof SeqOrderEvent) handleSequencerMessage((SeqOrderEvent) event);
   else if (event instanceof UniformInfoEvent) handleUniformInfo((UniformInfoEvent) event);
   else if (event instanceof UniformTimer) handleUniformTimer((UniformTimer) event);
   else if (event instanceof LeaveEvent) handleLeaveEvent((LeaveEvent) event);
   else if (event instanceof GroupSendableEvent) handleGroupSendable((GroupSendableEvent) event);
   else {
     log.warn("Got unexpected event in handle: " + event + ". Forwarding it.");
     try {
       event.go();
     } catch (AppiaEventException e) {
       e.printStackTrace();
     }
   }
 }