Beispiel #1
0
    @Override
    public void sendResponse(Exchange exchange, Response response) {

      if (response.getDestination() == null)
        throw new NullPointerException("Response has no destination address");
      if (response.getDestinationPort() == 0)
        throw new NullPointerException("Response has no destination port");

      matcher.sendResponse(exchange, response);

      /*
       * Logging here causes significant performance loss.
       * If necessary, add an interceptor that logs the messages,
       * e.g., the MessageTracer.
       */

      for (MessageInterceptor interceptor : interceptors) interceptor.sendResponse(response);

      // MessageInterceptor might have canceled
      if (!response.isCanceled()) connector.send(serializer.serialize(response));
    }