@Override public String toString() { return "request " + methodName + "(" + parameters + ")" + ( returnValues.size()>0 ? ": " + returnValues : ""); }
/** * Check whether the values stored in this object satisfies the * given type string. * * @return true if this value sequence satisfies 'types' * @param types type string **/ public boolean satisfies(String types) { int off = 0; int len = Math.min(types.length(), size()); while (off < len && types.charAt(off) == get(off).type()) { off++; } return ((off == types.length() && off == size()) || (off + 1 == types.length() && types.charAt(off) == '*')); }
private boolean validateResponse(Request request) { if (request.isError()) { return false; } else if (request.returnValues().size() == 0) { return false; } else if (!request.checkReturnTypes("is")) { // TODO: Do not hard-code return type log.log(LogLevel.WARNING, "Invalid return types for response: " + request.errorMessage()); return false; } return true; }
for (int i=0; i<returned.size(); i++) { System.out.println(returned.get(i));
@Override public void handleRequestDone(Request requestWithResponse) { if (requestWithResponse.isError()) { handler.receive(GetDocsumsResponseOrError.fromError("Error response from " + node + ": " + requestWithResponse.errorMessage())); return; } Values returnValues = requestWithResponse.returnValues(); if (returnValues.size() < 3) { handler.receive(GetDocsumsResponseOrError.fromError("Invalid getDocsums response from " + node + ": Expected 3 return arguments, got " + returnValues.size())); return; } byte compression = returnValues.get(0).asInt8(); int uncompressedSize = returnValues.get(1).asInt32(); byte[] compressedSlimeBytes = returnValues.get(2).asData(); List<FastHit> hits = (List<FastHit>) requestWithResponse.getContext(); handler.receive(GetDocsumsResponseOrError.fromResponse(new GetDocsumsResponse(compression, uncompressedSize, compressedSlimeBytes, hits))); }