SendContext(RoutingNode recipient, long timeRemaining) { this.recipient = recipient; trace = new Trace(recipient.getTrace().getLevel()); timeout = timeRemaining * 0.001; } }
/** * Constructs a new instance of this class. This is the child node constructor, and is the constructor used when * building the routing tree. * * @param parent The parent routing node. * @param route The route to assign to this. */ private RoutingNode(RoutingNode parent, Route route) { mbus = parent.mbus; net = parent.net; resender = parent.resender; handler = null; msg = parent.msg; trace = new Trace(parent.trace.getLevel()); this.route = new Route(route); this.parent = parent; recipients.addAll(parent.recipients); }
/** * Constructs a new instance of this class. This is the root node constructor, and will be used by the different * sessions for sending messages. Note that the {@link #discard()} functionality of this class is implemented so * that it passes a null reply to the handler to notify the discard. * * @param mbus The message bus on which we are running. * @param net The network layer we are to transmit through. * @param resender The resender to schedule with. * @param handler The handler to receive the final reply. * @param msg The message being sent. */ public RoutingNode(MessageBus mbus, Network net, Resender resender, ReplyHandler handler, Message msg) { this.mbus = mbus; this.net = net; this.resender = resender; this.handler = handler; this.msg = msg; this.trace = new Trace(msg.getTrace().getLevel()); this.route = msg.getRoute(); this.parent = null; if (route != null) { routeMetrics = mbus.getMetrics().getRouteMetrics(route); } }
log.log(LogLevel.SPAM, "Trace for reply:\n" + reply.getTrace()); Trace empty = new Trace(); trace.swap(empty); } else if (trace.getLevel() > 0) {
public MessageBusVisitorSession(VisitorParameters visitorParameters, AsyncTaskExecutor taskExecutor, SenderFactory senderFactory, ReceiverFactory receiverFactory, RoutingTable routingTable, Clock clock) throws ParseException { this.params = visitorParameters; // TODO(vekterli): make copy? legacy impl does not copy initializeRoute(routingTable); this.sender = senderFactory.createSender(createReplyHandler(), this.params); this.receiver = receiverFactory.createReceiver(createMessageHandler(), sessionName); this.taskExecutor = taskExecutor; this.progress = createVisitingProgress(params); this.statistics = new VisitorStatistics(); this.state = new StateDescription(State.NOT_STARTED); this.clock = clock; initializeHandlers(); trace = new Trace(visitorParameters.getTraceLevel()); dataDestination = (params.getLocalDataHandler() == null ? params.getRemoteDataHandler() : receiver.getConnectionSpec()); validateSessionParameters(); // If we're already done, no need to do anything at all! if (progress.getIterator().isDone()) { markSessionCompleted(); } }