@Override public byte[] serializeResponse(Response response) throws IOException { ByteArrayOutputStream out = new ByteArrayOutputStream(); Message responseMsg = response.serialize(); serializeMessage(out, responseMsg); return out.toByteArray(); }
@Override public byte[] serializeRequest(Request request) throws IOException { ByteArrayOutputStream out = new ByteArrayOutputStream(); Message requestMsg = request.serialize(); serializeMessage(out, requestMsg); return out.toByteArray(); }
@Override public byte[] serializeResponse(Response response) throws IOException { // Avoid BAOS for its synchronized write methods, we don't need that concurrency control UnsynchronizedBuffer out = threadLocalBuffer.get(); try { Message responseMsg = response.serialize(); // Serialization of the response may be large if (LOG.isTraceEnabled()) { LOG.trace("Serializing response '{}'", TextFormat.shortDebugString(responseMsg)); } serializeMessage(out, responseMsg); return out.toArray(); } finally { out.reset(); } }
@Override public byte[] serializeRequest(Request request) throws IOException { // Avoid BAOS for its synchronized write methods, we don't need that concurrency control UnsynchronizedBuffer out = threadLocalBuffer.get(); try { Message requestMsg = request.serialize(); // Serialization of the request may be large if (LOG.isTraceEnabled()) { LOG.trace("Serializing request '{}'", TextFormat.shortDebugString(requestMsg)); } serializeMessage(out, requestMsg); return out.toArray(); } finally { out.reset(); } }
@Override public byte[] serializeResponse(Response response) throws IOException { // Avoid BAOS for its synchronized write methods, we don't need that concurrency control UnsynchronizedBuffer out = threadLocalBuffer.get(); try { Message responseMsg = response.serialize(); // Serialization of the response may be large if (LOG.isTraceEnabled()) { LOG.trace("Serializing response '{}'", TextFormat.shortDebugString(responseMsg)); } serializeMessage(out, responseMsg); return out.toArray(); } finally { out.reset(); } }
@Override public byte[] serializeRequest(Request request) throws IOException { // Avoid BAOS for its synchronized write methods, we don't need that concurrency control UnsynchronizedBuffer out = threadLocalBuffer.get(); try { Message requestMsg = request.serialize(); // Serialization of the request may be large if (LOG.isTraceEnabled()) { LOG.trace("Serializing request '{}'", TextFormat.shortDebugString(requestMsg)); } serializeMessage(out, requestMsg); return out.toArray(); } finally { out.reset(); } }