Beispiel #1
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();
     }
   }
 }
Beispiel #2
0
  /**
   * The event handler function. Tests event types and dispatches them to the appropriate handler.
   *
   * @param e The event
   * @see Session#handle
   */
  public void handle(Event e) {

    if (e instanceof RegisterSocketEvent) handleRegisterSocket((RegisterSocketEvent) e);
    else if (e instanceof SendableEvent) handleSendable((SendableEvent) e);
    else if (e instanceof ChannelInit) handleChannelInit((ChannelInit) e);
    else if (e instanceof ChannelClose) handleChannelClose((ChannelClose) e);
    else if (e instanceof Debug) handleDebug((Debug) e);
    else if (e instanceof MaxPDUSizeEvent) handlePDUSize((MaxPDUSizeEvent) e);
    else if (e instanceof MulticastInitEvent) handleMulticastInit((MulticastInitEvent) e);
    else {
      /*Unexpected event received in UdpSimpleSession */
      try {
        log.warn(":handle: Unexpected event. Forwarding it...");
        e.go();
      } catch (AppiaEventException ex) {
      }
    }
  }