@Override public void run() { final Reply reply = this.reply; this.reply = null; handler.handleReply(reply); }
/** * Sends a reply to a message. The reply will propagate back to the original sender, prefering the same route as it * used to reach the detination. * * @param reply The reply, created from the message this is a reply to. */ public void reply(Reply reply) { ReplyHandler handler = reply.popHandler(); handler.handleReply(reply); }
@Override public void handleReply(Reply reply) { if (destroyed.get()) { reply.discard(); } else { replyHandler.handleReply(reply); } } }
/** * Discards this routing node. Invoking this will notify the parent {@link SendProxy} to ensure that the * corresponding message is discarded. This is a required step to ensure safe shutdown if you need to destroy a * message bus instance while there are still routing nodes alive in your application. */ public void discard() { if (handler != null) { handler.handleReply(null); } else if (parent != null) { parent.discard(); } }
@Override public void handleReply(Reply reply) { reply.popHandler().handleReply(reply); }
@Override public void handleReply(Reply reply) { reply.popHandler().handleReply(reply); }
/** * This method may only be invoked on a root node, as it passes the current reply to the member {@link * ReplyHandler}. */ private void notifySender() { reply.getTrace().swap(trace); handler.handleReply(reply); reply = null; }
/** * Forwards a routable to the next hop in its route. This method will never block. * @param routable the routable to forward. */ public void forward(Routable routable) { if (routable instanceof Reply) { Reply reply = (Reply)routable; ReplyHandler handler = reply.popHandler(); handler.handleReply(reply); } else { routable.pushHandler(this); mbus.handleMessage((Message)routable); } }
handler.handleReply(reply);
boolean notifyIfExpired() { if (msg.isExpired()) { Error error = new Error(ErrorCode.TIMEOUT, "Timed out in sendQ"); notifyComplete(new Result(error)); replyHandler.handleReply(createSendTimedoutReply(msg, error)); return true; } return false; }
@Override public void handleReply(Reply reply) { if (reply.getContext() instanceof RequestMonitor) { ((RequestMonitor)reply.getContext()).replied(reply); } else { ReplyHandler handler = reply.getCallStack().pop(reply); handler.handleReply(reply); // not there yet } }
@Override public void handleReply(Reply reply) { if (destroyed.get()) { reply.discard(); return; } boolean done; synchronized (lock) { --pendingCount; if (throttlePolicy != null) { throttlePolicy.processReply(reply); } done = (closed && pendingCount == 0); sendBlockedMessages(); } if (reply.getTrace().shouldTrace(TraceLevel.COMPONENT)) { reply.getTrace().trace(TraceLevel.COMPONENT, "Source session received reply. " + pendingCount + " message(s) now pending."); } ReplyHandler handler = reply.popHandler(); handler.handleReply(reply); if (done) { this.done.countDown(); } }
private boolean sendMessage(final MbusRequest request) { Error error; final Long millis = request.timeRemaining(TimeUnit.MILLISECONDS); if (millis != null && millis <= 0) { error = new Error(ErrorCode.TIMEOUT, request.getTimeout(TimeUnit.MILLISECONDS) + " millis"); } else if (request.isCancelled()) { error = new Error(ErrorCode.APP_FATAL_ERROR, "request cancelled"); } else { try { error = session.sendMessage(request.getMessage()).getError(); } catch (final Exception e) { error = new Error(ErrorCode.FATAL_ERROR, e.toString()); } } if (error == null) { return true; } if (error.isFatal()) { final Reply reply = new EmptyReply(); reply.swapState(request.getMessage()); reply.addError(error); reply.popHandler().handleReply(reply); return true; } return false; }
handler.handleReply(reply);