Source:
public void receiveRequest(final Request request, final EndpointReceiver receiver) { final KeyMID idByMID = new KeyMID(request.getMID(), endpointContextMatcher.getEndpointIdentity(request.getSourceContext())); final Exchange exchange = new Exchange(request, Origin.REMOTE, executor); final Exchange previous = exchangeStore.findPrevious(idByMID, exchange); boolean duplicate = previous != null; if (duplicate) { if (previous.getOrigin() != Origin.REMOTE) { duplicate = false; } else { EndpointContext sourceContext = request.getSourceContext(); Request previousRequest = previous.getCurrentRequest(); EndpointContext previousSourceContext = previousRequest.getSourceContext(); duplicate = endpointContextMatcher.isToBeSent(previousSourceContext, sourceContext); } if (!duplicate) { if (exchangeStore.replacePrevious(idByMID, previous, exchange)) { LOGGER.debug("replaced request by new request {}!", previous.getCurrentRequest(), request); } else { LOGGER.warn("new request could not be registered! Deduplication disabled!", request); } } } if (duplicate) { LOGGER.trace("duplicate request: {}", request); request.setDuplicate(true); previous.execute(new Runnable() { @Override public void run() { try { receiver.receiveRequest(previous, request); } catch (RuntimeException ex) { LOGGER.warn("error receiving request again!", request, ex); receiver.reject(request); } } }); } else { exchange.setRemoveHandler(exchangeRemoveHandler); exchange.execute(new Runnable() { @Override public void run() { try { receiver.receiveRequest(exchange, request); } catch (RuntimeException ex) { LOGGER.warn("error receiving request {}", request, ex); receiver.reject(request); } } }); } }

Target:
public void receiveRequest(final Request request, final EndpointReceiver receiver) { final KeyMID idByMID = new KeyMID(request.getMID(), endpointContextMatcher.getEndpointIdentity(request.getSourceContext())); final Exchange exchange = new Exchange(request, Origin.REMOTE, executor); final Exchange previous = exchangeStore.findPrevious(idByMID, exchange); boolean duplicate = previous != null; if (duplicate) { EndpointContext sourceContext = request.getSourceContext(); Request previousRequest = previous.getCurrentRequest(); EndpointContext previousSourceContext; if (previous.getOrigin() == Origin.REMOTE) { previousSourceContext = previousRequest.getSourceContext(); } else { previousSourceContext = previousRequest.getDestinationContext(); } duplicate = endpointContextMatcher.isToBeSent(previousSourceContext, sourceContext); if (!duplicate) { if (exchangeStore.replacePrevious(idByMID, previous, exchange)) { LOGGER.debug("replaced request by new request {}!", previousRequest, request); } else { LOGGER.warn("new request could not be registered! Deduplication disabled!", request); } } } if (duplicate) { LOGGER.trace("duplicate request: {}", request); request.setDuplicate(true); previous.execute(new Runnable() { @Override public void run() { try { receiver.receiveRequest(previous, request); } catch (RuntimeException ex) { LOGGER.warn("error receiving request again!", request, ex); receiver.reject(request); } } }); } else { exchange.setRemoveHandler(exchangeRemoveHandler); exchange.execute(new Runnable() { @Override public void run() { try { receiver.receiveRequest(exchange, request); } catch (RuntimeException ex) { LOGGER.warn("error receiving request {}", request, ex); receiver.reject(request); } } }); } }