Ejemplo n.º 1
0
    public void postProcess(Message msg) {
      // call handler
      List<ExtendedMessageHandler> handlerList =
          AbstractRoutingDriver.this.extendedHandlerTable.get(msg.getClass());
      if (handlerList != null) {
        for (ExtendedMessageHandler handler : handlerList) {
          try {
            handler.postProcess(msg);
          } catch (Throwable e) {
            logger.log(Level.SEVERE, "A MessageHandler#postProcess() threw an Exception.", e);
          }
        }
      }

      // notify the routing algorithm
      if (AbstractRoutingDriver.this.algorithm != null) {
        IDAddressPair src = (IDAddressPair) msg.getSource();
        if (src.getID() != null && src.getAddress() != null) {
          AbstractRoutingDriver.this.algorithm.touch(src);
        }
      }
    }
Ejemplo n.º 2
0
  protected void postProcessMessage(Message msg) {
    if (!this.extMessageHandlerRegistered) return;

    // call every handlers
    List<MessageHandler> currentHandlerList;
    synchronized (this) {
      currentHandlerList = handlerList;
    }

    for (MessageHandler handler : currentHandlerList) {
      ExtendedMessageHandler extHandler;
      try {
        extHandler = (ExtendedMessageHandler) handler;
      } catch (ClassCastException e) {
        continue;
      }

      try {
        extHandler.postProcess(msg);
      } catch (Throwable e) {
        logger.log(Level.SEVERE, "A MessageHandler#postProcess() threw an Exception.", e);
      }
    }
  }