log.log(LogLevel.DEBUG, "Invoking mbus.getVersion() on target '" + name + "'"); Request req = new Request("mbus.getVersion"); target.invokeAsync(req, timeout, this);
protected Request createRequest(String method,List<String> arguments) { Request request=new Request(method); if (arguments!=null) { for (String argument : arguments) request.parameters().add(getArgument(request,argument)); } return request; }
public RegisterCallback(Request req, String name, String spec) { req.detach(); registerReq = req; this.name = name; this.spec = spec; target = orb.connect(new Spec(spec)); Request cbReq = new Request("slobrok.callback.listNamesServed"); target.invokeAsync(cbReq, 5.0, this); }
/** * Handle a packet received on one of the connections associated * with this Supervisor. This method is invoked for all packets * not handled by a {@link ReplyHandler} * * @param conn where the packet came from * @param packet the packet **/ void handlePacket(Connection conn, Packet packet) { if (packet.packetCode() != Packet.PCODE_REQUEST) { return; } RequestPacket rp = (RequestPacket) packet; Request req = new Request(rp.methodName(), rp.parameters()); Method method = methodMap.get(req.methodName()); new InvocationServer(conn, req, method, packet.requestId(), packet.noReply()).invoke(); } }
void receive(FileReference reference, String filename, byte[] content) { log.log(LogLevel.INFO, "Preparing receive call for " + reference.value() + " and file " + filename); XXHash64 hasher = XXHashFactory.fastestInstance().hash64(); Request fileBlob = new Request("filedistribution.receiveFile"); log.log(LogLevel.INFO, "Calling " + fileBlob.methodName() + " with target " + target); fileBlob.parameters().add(new StringValue(reference.value())); fileBlob.parameters().add(new StringValue(filename)); fileBlob.parameters().add(new DataValue(content)); fileBlob.parameters().add(new Int64Value(hasher.hash(ByteBuffer.wrap(content), 0))); fileBlob.parameters().add(new Int32Value(0)); fileBlob.parameters().add(new StringValue("OK")); log.log(LogLevel.INFO, "Doing invokeSync"); target.invokeSync(fileBlob, 5); log.log(LogLevel.INFO, "Done with invokeSync"); } }
break; Request request = new Request("waitFor"); request.parameters().add(new StringValue(fileReference.value()));
private boolean startDownloadRpc(FileReferenceDownload fileReferenceDownload, int retryCount) { Connection connection = connectionPool.getCurrent(); Request request = new Request("filedistribution.serveFile"); String fileReference = fileReferenceDownload.fileReference().value(); request.parameters().add(new StringValue(fileReference)); request.parameters().add(new Int32Value(fileReferenceDownload.downloadFromOtherSourceIfNotFound() ? 0 : 1)); execute(request, connection); Level logLevel = (retryCount > 0 ? LogLevel.INFO : LogLevel.DEBUG); if (validateResponse(request)) { log.log(logLevel, () -> "Request callback, OK. Req: " + request + "\nSpec: " + connection); if (request.returnValues().get(0).asInt32() == 0) { log.log(logLevel, () -> "Found file reference '" + fileReference + "' available at " + connection.getAddress()); return true; } else { log.log(logLevel, "File reference '" + fileReference + "' not found for " + connection.getAddress()); connectionPool.setNewCurrentConnection(); return false; } } else { log.log(logLevel, "Request failed. Req: " + request + "\nSpec: " + connection.getAddress() + ", error code: " + request.errorCode() + ", set error for connection and use another for next request"); connectionPool.setError(connection, request.errorCode()); return false; } }
@Override public void getDocsums(List<FastHit> hits, NodeConnection node, CompressionType compression, int uncompressedLength, byte[] compressedSlime, RpcFillInvoker.GetDocsumsResponseReceiver responseReceiver, double timeoutSeconds) { Request request = new Request("proton.getDocsums"); request.parameters().add(new Int8Value(compression.getCode())); request.parameters().add(new Int32Value(uncompressedLength)); request.parameters().add(new DataValue(compressedSlime)); request.setContext(hits); RpcNodeConnection rpcNode = ((RpcNodeConnection) node); rpcNode.invokeAsync(request, timeoutSeconds, new RpcResponseWaiter(rpcNode, responseReceiver)); }
specsGeneration = 0; req = new Request("slobrok.incremental.fetch"); req.parameters().add(new Int32Value(specsGeneration)); // gencnt req.parameters().add(new Int32Value(5000)); // mstimeout
@Override protected Request encodeRequest(Version version, Route route, RPCServiceAddress address, Message msg, long timeRemaining, byte[] payload, int traceLevel) { Request req = new Request(METHOD_NAME); Values v = req.parameters(); v.add(new StringValue(version.toString())); v.add(new StringValue(route.toString())); v.add(new StringValue(address.getSessionName())); v.add(new Int8Value(msg.getRetryEnabled() ? (byte)1 : (byte)0)); v.add(new Int32Value(msg.getRetry())); v.add(new Int64Value(timeRemaining)); v.add(new StringValue(msg.getProtocol())); v.add(new DataValue(payload)); v.add(new Int32Value(traceLevel)); return req; }
@Override protected Request encodeRequest(Version version, Route route, RPCServiceAddress address, Message msg, long timeRemaining, byte[] payload, int traceLevel) { Request req = new Request(METHOD_NAME); Values v = req.parameters(); v.add(new Int8Value(CompressionType.NONE.getCode())); v.add(new Int32Value(0)); v.add(new DataValue(new byte[0])); Slime slime = new Slime(); Cursor root = slime.setObject(); root.setString(VERSION_F, version.toString()); root.setString(ROUTE_F, route.toString()); root.setString(SESSION_F, address.getSessionName()); root.setString(PROTOCOL_F, msg.getProtocol().toString()); root.setBool(USERETRY_F, msg.getRetryEnabled()); root.setLong(RETRY_F, msg.getRetry()); root.setLong(TIMEREMAINING_F, msg.getTimeRemaining()); root.setLong(TRACELEVEL_F, traceLevel); root.setData(BLOB_F, payload); byte[] serializedSlime = BinaryFormat.encode(slime); Compressor.Compression compressionResult = compressor.compress(serializedSlime); v.add(new Int8Value(compressionResult.type().getCode())); v.add(new Int32Value(compressionResult.uncompressedSize())); v.add(new DataValue(compressionResult.data())); return req; }