com.alibaba.dubbo.remoting.exchange.Response Java Examples
The following examples show how to use
com.alibaba.dubbo.remoting.exchange.Response.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ExchangeCodecTest.java From dubbox with Apache License 2.0 | 6 votes |
@Test public void testMessageLengthExceedPayloadLimitWhenEncode() throws Exception { Request request = new Request(1L); request.setData("hello"); ChannelBuffer encodeBuffer = ChannelBuffers.dynamicBuffer(512); AbstractMockChannel channel = getCliendSideChannel(url.addParameter(Constants.PAYLOAD_KEY, 4)); try { codec.encode(channel, encodeBuffer, request); Assert.fail(); } catch (IOException e) { Assert.assertTrue(e.getMessage().startsWith("Data length too large: " + 6)); } Response response = new Response(1L); response.setResult("hello"); encodeBuffer = ChannelBuffers.dynamicBuffer(512); channel = getServerSideChannel(url.addParameter(Constants.PAYLOAD_KEY, 4)); codec.encode(channel, encodeBuffer, response); Assert.assertTrue(channel.getReceivedMessage() instanceof Response); Response receiveMessage = (Response) channel.getReceivedMessage(); Assert.assertEquals(Response.BAD_RESPONSE, receiveMessage.getStatus()); Assert.assertTrue(receiveMessage.getErrorMessage().contains("Data length too large: ")); }
Example #2
Source File: DefaultFuture.java From dubbox-hystrix with Apache License 2.0 | 6 votes |
public static void received(Channel channel, Response response) { try { DefaultFuture future = FUTURES.remove(response.getId()); if (future != null) { future.doReceived(response); } else { logger.warn("The timeout response finally returned at " + (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS").format(new Date())) + ", response " + response + (channel == null ? "" : ", channel: " + channel.getLocalAddress() + " -> " + channel.getRemoteAddress())); } } finally { CHANNELS.remove(response.getId()); } }
Example #3
Source File: HeaderExchangeHandlerTest.java From dubbo3 with Apache License 2.0 | 6 votes |
@Test public void test_received_request_twoway_error_reqeustBroken() throws RemotingException{ final Request request = new Request(); request.setTwoWay(true); request.setData(new BizException()); request.setBroken(true); final AtomicInteger count = new AtomicInteger(0); final Channel mchannel = new MockedChannel(){ @Override public void send(Object message) throws RemotingException { Response res = (Response)message; Assert.assertEquals(request.getId(), res.getId()); Assert.assertEquals(request.getVersion(), res.getVersion()); Assert.assertEquals(Response.BAD_REQUEST, res.getStatus()); Assert.assertNull(res.getResult()); Assert.assertTrue(res.getErrorMessage().contains(BizException.class.getName())); count.incrementAndGet(); } }; HeaderExchangeHandler hexhandler = new HeaderExchangeHandler(new MockedExchangeHandler()); hexhandler.received(mchannel, request); Assert.assertEquals(1, count.get()); }
Example #4
Source File: HeaderExchangeHandler.java From dubbox with Apache License 2.0 | 6 votes |
public void caught(Channel channel, Throwable exception) throws RemotingException { if (exception instanceof ExecutionException) { ExecutionException e = (ExecutionException) exception; Object msg = e.getRequest(); if (msg instanceof Request) { Request req = (Request) msg; if (req.isTwoWay() && ! req.isHeartbeat()) { Response res = new Response(req.getId(), req.getVersion()); res.setStatus(Response.SERVER_ERROR); res.setErrorMessage(StringUtils.toString(e)); channel.send(res); return; } } } ExchangeChannel exchangeChannel = HeaderExchangeChannel.getOrAddChannel(channel); try { handler.caught(exchangeChannel, exception); } finally { HeaderExchangeChannel.removeChannelIfDisconnected(channel); } }
Example #5
Source File: ExchangeCodecTest.java From dubbo-2.6.5 with Apache License 2.0 | 6 votes |
@Test public void testInvalidSerializaitonId() throws Exception { byte[] header = new byte[]{MAGIC_HIGH, MAGIC_LOW, (byte)0x8F, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; Object obj = decode(header); Assert.assertTrue(obj instanceof Request); Request request = (Request) obj; Assert.assertTrue(request.isBroken()); Assert.assertTrue(request.getData() instanceof IOException); header = new byte[]{MAGIC_HIGH, MAGIC_LOW, (byte)0x1F, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; obj = decode(header); Assert.assertTrue(obj instanceof Response); Response response = (Response) obj; Assert.assertEquals(response.getStatus(), Response.CLIENT_ERROR); Assert.assertTrue(response.getErrorMessage().contains("IOException")); }
Example #6
Source File: DefaultFuture.java From dubbox with Apache License 2.0 | 6 votes |
public void run() { while (true) { try { for (DefaultFuture future : FUTURES.values()) { if (future == null || future.isDone()) { continue; } if (System.currentTimeMillis() - future.getStartTimestamp() > future.getTimeout()) { // create exception response. Response timeoutResponse = new Response(future.getId()); // set timeout status. timeoutResponse.setStatus(future.isSent() ? Response.SERVER_TIMEOUT : Response.CLIENT_TIMEOUT); timeoutResponse.setErrorMessage(future.getTimeoutMessage(true)); // handle response. DefaultFuture.received(future.getChannel(), timeoutResponse); } } Thread.sleep(30); } catch (Throwable e) { logger.error("Exception when scan the timeout invocation of remoting.", e); } } }
Example #7
Source File: ExchangeCodecTest.java From dubbox with Apache License 2.0 | 6 votes |
@Test public void testMessageLengthExceedPayloadLimitWhenEncode() throws Exception { Request request = new Request(1L); request.setData("hello"); ChannelBuffer encodeBuffer = ChannelBuffers.dynamicBuffer(512); AbstractMockChannel channel = getCliendSideChannel(url.addParameter(Constants.PAYLOAD_KEY, 4)); try { codec.encode(channel, encodeBuffer, request); Assert.fail(); } catch (IOException e) { Assert.assertTrue(e.getMessage().startsWith("Data length too large: " + 6)); } Response response = new Response(1L); response.setResult("hello"); encodeBuffer = ChannelBuffers.dynamicBuffer(512); channel = getServerSideChannel(url.addParameter(Constants.PAYLOAD_KEY, 4)); codec.encode(channel, encodeBuffer, response); Assert.assertTrue(channel.getReceivedMessage() instanceof Response); Response receiveMessage = (Response) channel.getReceivedMessage(); Assert.assertEquals(Response.BAD_RESPONSE, receiveMessage.getStatus()); Assert.assertTrue(receiveMessage.getErrorMessage().contains("Data length too large: ")); }
Example #8
Source File: HeaderExchangeHandlerTest.java From dubbox with Apache License 2.0 | 6 votes |
@Test public void test_received_request_twoway_error_reqeustBroken() throws RemotingException{ final Request request = new Request(); request.setTwoWay(true); request.setData(new BizException()); request.setBroken(true); final AtomicInteger count = new AtomicInteger(0); final Channel mchannel = new MockedChannel(){ @Override public void send(Object message) throws RemotingException { Response res = (Response)message; Assert.assertEquals(request.getId(), res.getId()); Assert.assertEquals(request.getVersion(), res.getVersion()); Assert.assertEquals(Response.BAD_REQUEST, res.getStatus()); Assert.assertNull(res.getResult()); Assert.assertTrue(res.getErrorMessage().contains(BizException.class.getName())); count.incrementAndGet(); } }; HeaderExchangeHandler hexhandler = new HeaderExchangeHandler(new MockedExchangeHandler()); hexhandler.received(mchannel, request); Assert.assertEquals(1, count.get()); }
Example #9
Source File: HeaderExchangeChannel.java From dubbox-hystrix with Apache License 2.0 | 6 votes |
public void send(Object message, boolean sent) throws RemotingException { if (closed) { throw new RemotingException(this.getLocalAddress(), null, "Failed to send message " + message + ", cause: The channel " + this + " is closed!"); } if (message instanceof Request || message instanceof Response || message instanceof String) { channel.send(message, sent); } else { Request request = new Request(); request.setVersion("2.0.0"); request.setTwoWay(false); request.setData(message); channel.send(request, sent); } }
Example #10
Source File: DecodeHandler.java From dubbo-2.6.5 with Apache License 2.0 | 6 votes |
@Override public void received(Channel channel, Object message) throws RemotingException { if (message instanceof Decodeable) { decode(message); } if (message instanceof Request) { decode(((Request) message).getData()); } if (message instanceof Response) { // 响应信息解码=》decode() decode(((Response) message).getResult()); } // =》com.alibaba.dubbo.remoting.exchange.support.header.HeaderExchangeHandler#received handler.received(channel, message); }
Example #11
Source File: HeaderExchangeHandlerTest.java From dubbox with Apache License 2.0 | 6 votes |
@Test public void test_received_request_twoway_error_reqeustBroken() throws RemotingException{ final Request request = new Request(); request.setTwoWay(true); request.setData(new BizException()); request.setBroken(true); final AtomicInteger count = new AtomicInteger(0); final Channel mchannel = new MockedChannel(){ @Override public void send(Object message) throws RemotingException { Response res = (Response)message; Assert.assertEquals(request.getId(), res.getId()); Assert.assertEquals(request.getVersion(), res.getVersion()); Assert.assertEquals(Response.BAD_REQUEST, res.getStatus()); Assert.assertNull(res.getResult()); Assert.assertTrue(res.getErrorMessage().contains(BizException.class.getName())); count.incrementAndGet(); } }; HeaderExchangeHandler hexhandler = new HeaderExchangeHandler(new MockedExchangeHandler()); hexhandler.received(mchannel, request); Assert.assertEquals(1, count.get()); }
Example #12
Source File: ConnectionOrderedChannelHandler.java From dubbo-2.6.5 with Apache License 2.0 | 6 votes |
@Override public void received(Channel channel, Object message) throws RemotingException { ExecutorService cexecutor = getExecutorService(); try { cexecutor.execute(new ChannelEventRunnable(channel, handler, ChannelState.RECEIVED, message)); } catch (Throwable t) { //fix, reject exception can not be sent to consumer because thread pool is full, resulting in consumers waiting till timeout. 修复,由于线程池已满,拒绝异常无法发送给使用者,导致使用者等待超时。 if (message instanceof Request && t instanceof RejectedExecutionException) { Request request = (Request) message; if (request.isTwoWay()) { String msg = "Server side(" + url.getIp() + "," + url.getPort() + ") threadpool is exhausted ,detail msg:" + t.getMessage(); Response response = new Response(request.getId(), request.getVersion()); response.setStatus(Response.SERVER_THREADPOOL_EXHAUSTED_ERROR); response.setErrorMessage(msg); channel.send(response); return; } } throw new ExecutionException(message, channel, getClass() + " error when process received event .", t); } }
Example #13
Source File: ExchangeCodec.java From dubbox-hystrix with Apache License 2.0 | 6 votes |
public void encode(Channel channel, ChannelBuffer buffer, Object msg) throws IOException { if (msg instanceof Request) { encodeRequest(channel, buffer, (Request) msg); } else if (msg instanceof Response) { encodeResponse(channel, buffer, (Response) msg); } else { super.encode(channel, buffer, msg); } // TODO modified by lishen // System.out.println(">>>>>>>>>>>>>>>>>>>>>> the resulting byte size of encoding is " + buffer.readableBytes()); if (logger.isTraceEnabled()) { logger.trace("the resulting byte size of encoding is " + buffer.readableBytes()); } }
Example #14
Source File: HeaderExchangeChannel.java From dubbox with Apache License 2.0 | 6 votes |
public void send(Object message, boolean sent) throws RemotingException { if (closed) { throw new RemotingException(this.getLocalAddress(), null, "Failed to send message " + message + ", cause: The channel " + this + " is closed!"); } if (message instanceof Request || message instanceof Response || message instanceof String) { channel.send(message, sent); } else { Request request = new Request(); request.setVersion("2.0.0"); request.setTwoWay(false); request.setData(message); channel.send(request, sent); } }
Example #15
Source File: ExchangeCodec.java From dubbox with Apache License 2.0 | 6 votes |
public void encode(Channel channel, ChannelBuffer buffer, Object msg) throws IOException { if (msg instanceof Request) { encodeRequest(channel, buffer, (Request) msg); } else if (msg instanceof Response) { encodeResponse(channel, buffer, (Response) msg); } else { super.encode(channel, buffer, msg); } // TODO modified by lishen // System.out.println(">>>>>>>>>>>>>>>>>>>>>> the resulting byte size of encoding is " + buffer.readableBytes()); if (logger.isTraceEnabled()) { logger.trace("the resulting byte size of encoding is " + buffer.readableBytes()); } }
Example #16
Source File: HeaderExchangeChannel.java From dubbo3 with Apache License 2.0 | 6 votes |
public void send(Object message, boolean sent) throws RemotingException { if (closed) { throw new RemotingException(this.getLocalAddress(), null, "Failed to send message " + message + ", cause: The channel " + this + " is closed!"); } if (message instanceof Request || message instanceof Response || message instanceof String) { channel.send(message, sent); } else { Request request = new Request(); request.setVersion("2.0.0"); request.setTwoWay(false); request.setData(message); channel.send(request, sent); } }
Example #17
Source File: HeaderExchangeHandler.java From dubbox with Apache License 2.0 | 6 votes |
public void caught(Channel channel, Throwable exception) throws RemotingException { if (exception instanceof ExecutionException) { ExecutionException e = (ExecutionException) exception; Object msg = e.getRequest(); if (msg instanceof Request) { Request req = (Request) msg; if (req.isTwoWay() && ! req.isHeartbeat()) { Response res = new Response(req.getId(), req.getVersion()); res.setStatus(Response.SERVER_ERROR); res.setErrorMessage(StringUtils.toString(e)); channel.send(res); return; } } } ExchangeChannel exchangeChannel = HeaderExchangeChannel.getOrAddChannel(channel); try { handler.caught(exchangeChannel, exception); } finally { HeaderExchangeChannel.removeChannelIfDisconnected(channel); } }
Example #18
Source File: HeaderExchangeHandlerTest.java From dubbox-hystrix with Apache License 2.0 | 6 votes |
@Test public void test_received_request_twoway_error_reqeustBroken() throws RemotingException{ final Request request = new Request(); request.setTwoWay(true); request.setData(new BizException()); request.setBroken(true); final AtomicInteger count = new AtomicInteger(0); final Channel mchannel = new MockedChannel(){ @Override public void send(Object message) throws RemotingException { Response res = (Response)message; Assert.assertEquals(request.getId(), res.getId()); Assert.assertEquals(request.getVersion(), res.getVersion()); Assert.assertEquals(Response.BAD_REQUEST, res.getStatus()); Assert.assertNull(res.getResult()); Assert.assertTrue(res.getErrorMessage().contains(BizException.class.getName())); count.incrementAndGet(); } }; HeaderExchangeHandler hexhandler = new HeaderExchangeHandler(new MockedExchangeHandler()); hexhandler.received(mchannel, request); Assert.assertEquals(1, count.get()); }
Example #19
Source File: ExchangeCodecTest.java From dubbox-hystrix with Apache License 2.0 | 6 votes |
@Test public void testMessageLengthExceedPayloadLimitWhenEncode() throws Exception { Request request = new Request(1L); request.setData("hello"); ChannelBuffer encodeBuffer = ChannelBuffers.dynamicBuffer(512); AbstractMockChannel channel = getCliendSideChannel(url.addParameter(Constants.PAYLOAD_KEY, 4)); try { codec.encode(channel, encodeBuffer, request); Assert.fail(); } catch (IOException e) { Assert.assertTrue(e.getMessage().startsWith("Data length too large: " + 6)); } Response response = new Response(1L); response.setResult("hello"); encodeBuffer = ChannelBuffers.dynamicBuffer(512); channel = getServerSideChannel(url.addParameter(Constants.PAYLOAD_KEY, 4)); codec.encode(channel, encodeBuffer, response); Assert.assertTrue(channel.getReceivedMessage() instanceof Response); Response receiveMessage = (Response) channel.getReceivedMessage(); Assert.assertEquals(Response.BAD_RESPONSE, receiveMessage.getStatus()); Assert.assertTrue(receiveMessage.getErrorMessage().contains("Data length too large: ")); }
Example #20
Source File: ThriftCodec.java From dubbox with Apache License 2.0 | 6 votes |
public void encode( Channel channel, ChannelBuffer buffer, Object message ) throws IOException { if ( message instanceof Request ) { encodeRequest( channel, buffer, ( Request ) message ); } else if ( message instanceof Response ) { encodeResponse( channel, buffer, ( Response ) message ); } else { throw new UnsupportedOperationException( new StringBuilder( 32 ) .append( "Thrift codec only support encode " ) .append( Request.class.getName() ) .append( " and " ) .append( Response.class.getName() ) .toString() ); } }
Example #21
Source File: DecodeableRpcResult.java From dubbo-2.6.5 with Apache License 2.0 | 6 votes |
@Override public void decode() throws Exception { if (!hasDecoded && channel != null && inputStream != null) { try { // =》com.alibaba.dubbo.rpc.protocol.dubbo.DecodeableRpcResult.decode(com.alibaba.dubbo.remoting.Channel, java.io.InputStream) decode(channel, inputStream); } catch (Throwable e) { if (log.isWarnEnabled()) { log.warn("Decode rpc result failed: " + e.getMessage(), e); } response.setStatus(Response.CLIENT_ERROR); response.setErrorMessage(StringUtils.toString(e)); } finally { hasDecoded = true; } } }
Example #22
Source File: HeaderExchangeChannel.java From dubbo-2.6.5 with Apache License 2.0 | 6 votes |
@Override public void send(Object message, boolean sent) throws RemotingException { if (closed) { throw new RemotingException(this.getLocalAddress(), null, "Failed to send message " + message + ", cause: The channel " + this + " is closed!"); } if (message instanceof Request || message instanceof Response || message instanceof String) { channel.send(message, sent); } else { Request request = new Request(); request.setVersion(Version.getProtocolVersion()); request.setTwoWay(false); request.setData(message); channel.send(request, sent); } }
Example #23
Source File: ExchangeCodecTest.java From dubbox with Apache License 2.0 | 5 votes |
@Test public void test_Decode_Error_Length() throws IOException{ byte[] header = new byte[] { MAGIC_HIGH, MAGIC_LOW, 0x20, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; Person person = new Person(); byte[] request = getRequestBytes(person, header); Channel channel = getServerSideChannel(url); byte[] baddata = new byte[]{1,2}; ChannelBuffer buffer = ChannelBuffers.wrappedBuffer(join(request, baddata)); Response obj = (Response)codec.decode(channel, buffer); Assert.assertEquals(person, obj.getResult()); //only decode necessary bytes Assert.assertEquals(request.length, buffer.readerIndex()); }
Example #24
Source File: ExchangeCodecTest.java From dubbox with Apache License 2.0 | 5 votes |
@Test //status输入有问题,序列化时读取信息出错. public void test_Decode_Return_Response_Error() throws IOException{ byte[] header = new byte[] { MAGIC_HIGH, MAGIC_LOW, 2, 90, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; String errorString = "encode request data error "; byte[] request = getRequestBytes(errorString, header); Response obj = (Response)decode(request); Assert.assertEquals(90, obj.getStatus()); Assert.assertEquals(errorString, obj.getErrorMessage()); }
Example #25
Source File: HeaderExchangeHandler.java From dubbox with Apache License 2.0 | 5 votes |
public void received(Channel channel, Object message) throws RemotingException { channel.setAttribute(KEY_READ_TIMESTAMP, System.currentTimeMillis()); ExchangeChannel exchangeChannel = HeaderExchangeChannel.getOrAddChannel(channel); try { if (message instanceof Request) { // handle request. Request request = (Request) message; if (request.isEvent()) { handlerEvent(channel, request); } else { if (request.isTwoWay()) { Response response = handleRequest(exchangeChannel, request); channel.send(response); } else { handler.received(exchangeChannel, request.getData()); } } } else if (message instanceof Response) { handleResponse(channel, (Response) message); } else if (message instanceof String) { if (isClientSide(channel)) { Exception e = new Exception("Dubbo client can not supported string message: " + message + " in channel: " + channel + ", url: " + channel.getUrl()); logger.error(e.getMessage(), e); } else { String echo = handler.telnet(channel, (String) message); if (echo != null && echo.length() > 0) { channel.send(echo); } } } else { handler.received(exchangeChannel, message); } } finally { HeaderExchangeChannel.removeChannelIfDisconnected(channel); } }
Example #26
Source File: DeprecatedExchangeCodec.java From dubbox with Apache License 2.0 | 5 votes |
public void encode(Channel channel, OutputStream os, Object msg) throws IOException { if (msg instanceof Request) { encodeRequest(channel, os, (Request) msg); } else if (msg instanceof Response) { encodeResponse(channel, os, (Response) msg); } else { super.encode(channel, os, msg); } }
Example #27
Source File: ThriftNativeCodec.java From dubbox with Apache License 2.0 | 5 votes |
public void encode(Channel channel, ChannelBuffer buffer, Object message) throws IOException { if (message instanceof Request) { encodeRequest(channel, buffer, (Request)message); } else if (message instanceof Response) { encodeResponse(channel, buffer, (Response)message); } else { throw new IOException("Unsupported message type " + message.getClass().getName()); } }
Example #28
Source File: HeartbeatHandler.java From dubbox with Apache License 2.0 | 5 votes |
public void received(Channel channel, Object message) throws RemotingException { setReadTimestamp(channel); if (isHeartbeatRequest(message)) { Request req = (Request) message; if (req.isTwoWay()) { Response res = new Response(req.getId(), req.getVersion()); res.setEvent(Response.HEARTBEAT_EVENT); channel.send(res); if (logger.isInfoEnabled()) { int heartbeat = channel.getUrl().getParameter(Constants.HEARTBEAT_KEY, 0); if(logger.isDebugEnabled()) { logger.debug("Received heartbeat from remote channel " + channel.getRemoteAddress() + ", cause: The channel has no data-transmission exceeds a heartbeat period" + (heartbeat > 0 ? ": " + heartbeat + "ms" : "")); } } } return; } if (isHeartbeatResponse(message)) { if (logger.isDebugEnabled()) { logger.debug( new StringBuilder(32) .append("Receive heartbeat response in thread ") .append(Thread.currentThread().getName()) .toString()); } return; } handler.received(channel, message); }
Example #29
Source File: DataSizeCodecWrapper.java From sofa-tracer with Apache License 2.0 | 5 votes |
/** * deserialization operation * @param channel * @param input * @return * @throws IOException */ @Override public Object decode(Channel channel, ChannelBuffer input) throws IOException { long startTime = System.currentTimeMillis(); int index = input.readerIndex(); Object ret = codec.decode(channel, input); int size = input.readerIndex() - index; long elapsed = System.currentTimeMillis() - startTime; if (ret instanceof Request) { // server-side deserialize the Request Object data = ((Request) ret).getData(); if (data instanceof RpcInvocation) { RpcInvocation invocation = (RpcInvocation) data; invocation.setAttachment(AttachmentKeyConstants.SERVER_DESERIALIZE_SIZE, String.valueOf(size)); invocation.setAttachment(AttachmentKeyConstants.SERVER_DESERIALIZE_TIME, String.valueOf(elapsed)); } } else if (ret instanceof Response) { // client-side deserialize the Response Object result = ((Response) ret).getResult(); if (result instanceof RpcResult) { RpcResult rpcResult = (RpcResult) result; rpcResult.setAttachment(AttachmentKeyConstants.CLIENT_DESERIALIZE_SIZE, String.valueOf(size)); rpcResult.setAttachment(AttachmentKeyConstants.CLIENT_DESERIALIZE_TIME, String.valueOf(elapsed)); } } return ret; }
Example #30
Source File: DataSizeCodecWrapper.java From sofa-tracer with Apache License 2.0 | 5 votes |
/** * @param channel a long connection * @param buffer buffer * @param message the original Request object * @throws IOException serialization exception */ protected void encodeResultWithTracer(Channel channel, ChannelBuffer buffer, Object message) throws IOException { Object result = ((Response) message).getResult(); long startTime = System.currentTimeMillis(); int index = buffer.writerIndex(); codec.encode(channel, buffer, message); int respSize = buffer.writerIndex() - index; long elapsed = System.currentTimeMillis() - startTime; ((RpcResult) result).setAttachment(AttachmentKeyConstants.SERVER_SERIALIZE_SIZE, String.valueOf(respSize)); ((RpcResult) result).setAttachment(AttachmentKeyConstants.SERVER_SERIALIZE_TIME, String.valueOf(elapsed)); }