/** This method implements {@link MessageHandler#process(Message) MessageHandler#process()}. */
    public Message process(Message msg) {
      Message ret = null;

      // call handler
      List<MessageHandler> handlerList =
          AbstractRoutingDriver.this.handlerTable.get(msg.getClass());
      if (handlerList != null) {
        for (MessageHandler handler : handlerList) {
          try {
            ret = handler.process(msg);
          } catch (Throwable e) {
            logger.log(Level.SEVERE, "A MessageHandler#process() threw an Exception.", e);
          }
        }
      }

      return ret;
    }
예제 #2
0
  protected Message processMessage(Message msg) {
    // call every handlers
    List<MessageHandler> currentHandlerList;
    synchronized (this) {
      currentHandlerList = handlerList;
    }

    Message ret = null;

    for (MessageHandler handler : currentHandlerList) {
      try {
        ret = handler.process(msg);
      } catch (Throwable e) {
        logger.log(Level.SEVERE, "A MessageHandler#process() threw an Exception.", e);
      }
    }

    return ret;
  }