use of org.eclipse.jetty.websocket.api.annotations.OnWebSocketMessage in project pulsar by yahoo.
the class SimpleTestProducerSocket method onMessage.
@OnWebSocketMessage
public void onMessage(String msg) throws JsonParseException {
JsonObject json = new Gson().fromJson(msg, JsonObject.class);
long endTimeNs = System.nanoTime();
long startTime = endTimeNs;
if (startTimeMap.get(json.get(CONTEXT)) != null)
startTime = startTimeMap.get(json.get(CONTEXT));
long latencyNs = endTimeNs - startTime;
recorder.recordValue(NANOSECONDS.toMicros(latencyNs));
}
Aggregations