use of com.yahoo.jrt.Request in project vespa by vespa-engine.
the class RPCSend method send.
@Override
public final void send(RoutingNode recipient, Version version, byte[] payload, long timeRemaining) {
SendContext ctx = new SendContext(recipient, timeRemaining);
RPCServiceAddress address = (RPCServiceAddress) recipient.getServiceAddress();
Message msg = recipient.getMessage();
Route route = new Route(recipient.getRoute());
Hop hop = route.removeHop(0);
Request req = encodeRequest(version, route, address, msg, timeRemaining, payload, ctx.trace.getLevel());
if (ctx.trace.shouldTrace(TraceLevel.SEND_RECEIVE)) {
ctx.trace.trace(TraceLevel.SEND_RECEIVE, "Sending message (version " + version + ") from " + clientIdent + " to '" + address.getServiceName() + "' with " + ctx.timeout + " seconds timeout.");
}
if (hop.getIgnoreResult()) {
address.getTarget().getJRTTarget().invokeVoid(req);
if (ctx.trace.shouldTrace(TraceLevel.SEND_RECEIVE)) {
ctx.trace.trace(TraceLevel.SEND_RECEIVE, "Not waiting for a reply from '" + address.getServiceName() + "'.");
}
Reply reply = new EmptyReply();
reply.getTrace().swap(ctx.trace);
net.getOwner().deliverReply(reply, recipient);
} else {
req.setContext(ctx);
address.getTarget().getJRTTarget().invokeAsync(req, ctx.timeout, this);
}
// allow garbage collection of request parameters
req.discardParameters();
}
Aggregations