@Override public void serverReceiveRequest(RPCContext context) { Stopwatch t = new Stopwatch(ticks); t.start(); this.activeRpcs.put(context, t); synchronized(receivePayloads) { IntegerHistogram<?> h = receivePayloads.get(context.getMessage()); if (h == null) { h = createNewIntegerHistogram(); receivePayloads.put(context.getMessage(), h); } h.add(getPayloadSize(context.getRequestPayload())); } }
@Override public void clientReceiveResponse(RPCContext context) { Stopwatch t = this.activeRpcs.remove(context); t.stop(); publish(context, t); synchronized(receivePayloads) { IntegerHistogram<?> h = receivePayloads.get(context.getMessage()); if (h == null) { h = createNewIntegerHistogram(); receivePayloads.put(context.getMessage(), h); } h.add(getPayloadSize(context.getRequestPayload())); } }
@Override public void clientSendRequest(RPCContext context) { Stopwatch t = new Stopwatch(ticks); t.start(); this.activeRpcs.put(context, t); synchronized(sendPayloads) { IntegerHistogram<?> h = sendPayloads.get(context.getMessage()); if (h == null) { h = createNewIntegerHistogram(); sendPayloads.put(context.getMessage(), h); } h.add(getPayloadSize(context.getRequestPayload())); } }
@Override public void clientSendRequest(RPCContext context) { ByteBuffer buf = ByteBuffer.wrap("ap".getBytes()); context.requestCallMeta().put(key, buf); Assert.assertNotNull(context.getMessage()); Assert.assertNotNull(context.getRequestPayload()); Assert.assertNull(context.getResponsePayload()); }
@Override public void clientFinishConnect(RPCContext context) { Map<String,ByteBuffer> handshakeMeta = context.responseHandshakeMeta(); Assert.assertNull(context.getRequestPayload()); Assert.assertNull(context.getResponsePayload()); Assert.assertNotNull(handshakeMeta); if (!handshakeMeta.containsKey(key)) return; ByteBuffer buf = handshakeMeta.get(key); Assert.assertNotNull(buf); Assert.assertNotNull(buf.array()); String partialstr = new String(buf.array()); Assert.assertNotNull(partialstr); Assert.assertEquals("partial string mismatch", "apac", partialstr); buf = ByteBuffer.wrap((partialstr + "he").getBytes()); Assert.assertTrue(buf.remaining() > 0); handshakeMeta.put(key, buf); checkRPCMetaMap(handshakeMeta); }
@Override public void clientReceiveResponse(RPCContext context) { Assert.assertNotNull(context.responseCallMeta()); Assert.assertNotNull(context.getRequestPayload()); if (!context.responseCallMeta().containsKey(key)) return; ByteBuffer buf = context.responseCallMeta().get(key); Assert.assertNotNull(buf); Assert.assertNotNull(buf.array()); String partialstr = new String(buf.array()); Assert.assertNotNull(partialstr); Assert.assertEquals("partial string mismatch", "apac", partialstr); buf = ByteBuffer.wrap((partialstr + "he").getBytes()); Assert.assertTrue(buf.remaining() > 0); context.responseCallMeta().put(key, buf); checkRPCMetaMap(context.responseCallMeta()); }
@Override public void serverConnecting(RPCContext context) { Assert.assertNotNull(context.requestHandshakeMeta()); Assert.assertNotNull(context.responseHandshakeMeta()); Assert.assertNull(context.getRequestPayload()); Assert.assertNull(context.getResponsePayload()); if (!context.requestHandshakeMeta().containsKey(key)) return; ByteBuffer buf = context.requestHandshakeMeta().get(key); Assert.assertNotNull(buf); Assert.assertNotNull(buf.array()); String partialstr = new String(buf.array()); Assert.assertNotNull(partialstr); Assert.assertEquals("partial string mismatch", "ap", partialstr); buf = ByteBuffer.wrap((partialstr + "ac").getBytes()); Assert.assertTrue(buf.remaining() > 0); context.responseHandshakeMeta().put(key, buf); }
@Override public void clientSendRequest(RPCContext context) { if (this.childSpan.get() != null) { Span child = this.childSpan.get(); Util.addEvent(child, SpanEvent.CLIENT_SEND); child.messageName = new Utf8( context.getMessage().getName()); child.requestPayloadSize = Util.getPayloadSize( context.getRequestPayload()); } }
@Override public void serverReceiveRequest(RPCContext context) { if (this.currentSpan.get() != null) { Span current = this.currentSpan.get(); Util.addEvent(current, SpanEvent.SERVER_RECV); current.messageName = new Utf8( context.getMessage().getName()); current.requestPayloadSize = Util.getPayloadSize( context.getRequestPayload()); } }
@Override public void clientReceiveResponse(RPCContext context) { Stopwatch t = this.activeRpcs.remove(context); t.stop(); publish(context, t); synchronized(receivePayloads) { IntegerHistogram<?> h = receivePayloads.get(context.getMessage()); if (h == null) { h = createNewIntegerHistogram(); receivePayloads.put(context.getMessage(), h); } h.add(getPayloadSize(context.getRequestPayload())); } }
@Override public void clientReceiveResponse(RPCContext context) { Stopwatch t = this.activeRpcs.remove(context); t.stop(); publish(context, t); synchronized(receivePayloads) { IntegerHistogram<?> h = receivePayloads.get(context.getMessage()); if (h == null) { h = createNewIntegerHistogram(); receivePayloads.put(context.getMessage(), h); } h.add(getPayloadSize(context.getRequestPayload())); } }
@Override public void serverReceiveRequest(RPCContext context) { Stopwatch t = new Stopwatch(ticks); t.start(); this.activeRpcs.put(context, t); synchronized(receivePayloads) { IntegerHistogram<?> h = receivePayloads.get(context.getMessage()); if (h == null) { h = createNewIntegerHistogram(); receivePayloads.put(context.getMessage(), h); } h.add(getPayloadSize(context.getRequestPayload())); } }
@Override public void clientSendRequest(RPCContext context) { Stopwatch t = new Stopwatch(ticks); t.start(); this.activeRpcs.put(context, t); synchronized(sendPayloads) { IntegerHistogram<?> h = sendPayloads.get(context.getMessage()); if (h == null) { h = createNewIntegerHistogram(); sendPayloads.put(context.getMessage(), h); } h.add(getPayloadSize(context.getRequestPayload())); } }
@Override public void serverReceiveRequest(RPCContext context) { Stopwatch t = new Stopwatch(ticks); t.start(); this.activeRpcs.put(context, t); synchronized(receivePayloads) { IntegerHistogram<?> h = receivePayloads.get(context.getMessage()); if (h == null) { h = createNewIntegerHistogram(); receivePayloads.put(context.getMessage(), h); } h.add(getPayloadSize(context.getRequestPayload())); } }
@Override public void clientSendRequest(RPCContext context) { Stopwatch t = new Stopwatch(ticks); t.start(); this.activeRpcs.put(context, t); synchronized(sendPayloads) { IntegerHistogram<?> h = sendPayloads.get(context.getMessage()); if (h == null) { h = createNewIntegerHistogram(); sendPayloads.put(context.getMessage(), h); } h.add(getPayloadSize(context.getRequestPayload())); } }