public <T> T getValue(T value) throws IOException { return RpcWritable.wrap(value).readFrom(bb); }
private void doSaslReply(Message message) throws IOException { final RpcCall saslCall = new RpcCall(this, AuthProtocol.SASL.callId); setupResponse(saslCall, RpcStatusProto.SUCCESS, null, RpcWritable.wrap(message), null, null); sendResponse(saslCall); }
@Override public void setResponse(Message message) { long processingTime = Time.now() - setupTime; call.setDeferredResponse(RpcWritable.wrap(message)); server.updateDeferredMetrics(methodName, processingTime); }
private byte[] setupResponseForWritable( RpcResponseHeaderProto header, Writable rv) throws IOException { ResponseBuffer buf = responseBuffer.get().reset(); try { RpcWritable.wrap(header).writeTo(buf); if (rv != null) { RpcWritable.wrap(rv).writeTo(buf); } return buf.toByteArray(); } finally { // Discard a large buf and reset it back to smaller size // to free up heap. if (buf.capacity() > maxRespSize) { buf.setCapacity(INITIAL_RESP_BUF_SIZE); } } }
RpcWritable.wrap(call.rpcRequest).writeTo(buf);
private void wrapWithSasl(RpcCall call) throws IOException { if (call.connection.saslServer != null) { byte[] token = call.rpcResponse.array(); // synchronization may be needed since there can be multiple Handler // threads using saslServer to wrap responses. synchronized (call.connection.saslServer) { token = call.connection.saslServer.wrap(token, 0, token.length); } if (LOG.isDebugEnabled()) LOG.debug("Adding saslServer wrapped token of size " + token.length + " as call response."); // rebuild with sasl header and payload RpcResponseHeaderProto saslHeader = RpcResponseHeaderProto.newBuilder() .setCallId(AuthProtocol.SASL.callId) .setStatus(RpcStatusProto.SUCCESS) .build(); RpcSaslProto saslMessage = RpcSaslProto.newBuilder() .setState(SaslState.WRAP) .setToken(ByteString.copyFrom(token)) .build(); setupResponse(call, saslHeader, RpcWritable.wrap(saslMessage)); } }
isDeferred); return RpcWritable.wrap(result);
public <T> T getValue(T value) throws IOException { return RpcWritable.wrap(value).readFrom(bb); }
private void doSaslReply(Message message) throws IOException { final RpcCall saslCall = new RpcCall(this, AuthProtocol.SASL.callId); setupResponse(saslCall, RpcStatusProto.SUCCESS, null, RpcWritable.wrap(message), null, null); sendResponse(saslCall); }
private byte[] setupResponseForWritable( RpcResponseHeaderProto header, Writable rv) throws IOException { ResponseBuffer buf = responseBuffer.get().reset(); try { RpcWritable.wrap(header).writeTo(buf); if (rv != null) { RpcWritable.wrap(rv).writeTo(buf); } return buf.toByteArray(); } finally { // Discard a large buf and reset it back to smaller size // to free up heap. if (buf.capacity() > maxRespSize) { buf.setCapacity(INITIAL_RESP_BUF_SIZE); } } }
RpcWritable.wrap(call.rpcRequest).writeTo(buf);
private void wrapWithSasl(RpcCall call) throws IOException { if (call.connection.saslServer != null) { byte[] token = call.rpcResponse.array(); // synchronization may be needed since there can be multiple Handler // threads using saslServer to wrap responses. synchronized (call.connection.saslServer) { token = call.connection.saslServer.wrap(token, 0, token.length); } if (LOG.isDebugEnabled()) LOG.debug("Adding saslServer wrapped token of size " + token.length + " as call response."); // rebuild with sasl header and payload RpcResponseHeaderProto saslHeader = RpcResponseHeaderProto.newBuilder() .setCallId(AuthProtocol.SASL.callId) .setStatus(RpcStatusProto.SUCCESS) .build(); RpcSaslProto saslMessage = RpcSaslProto.newBuilder() .setState(SaslState.WRAP) .setToken(ByteString.copyFrom(token)) .build(); setupResponse(call, saslHeader, RpcWritable.wrap(saslMessage)); } }
server.updateMetrics(detailedMetricsName, qTime, processingTime); return RpcWritable.wrap(result);