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 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);