Top Description Constructors Methods
org.eclipse.jetty.server.handler

public abstract Class LatencyRecordingHandler

extends EventsHandler
Class Inheritance
Imports
org.eclipse.jetty.server.Handler, .Request, org.eclipse.jetty.util.NanoTime

A Handler that helps recording the total latency of the requests executed by the wrapped handler.

The latency reported by onRequestComplete(String, long) is the delay between when the request arrived to a connector until the completion of that request.

Constructor Summary

AccessConstructor and Description
public
public

Method Summary

Modifier and TypeMethod and Description
protected final void
onComplete(Request
the request object. The read(), demand(Runnable) and fail(Throwable) methods must not be called by the listener.
request
,
Throwable
if there was a failure to complete
failure
)

Overrides org.eclipse.jetty.server.handler.EventsHandler.onComplete.

Invoked when the request and response processing are complete, just before the request and response will be recycled (i.e. after the Runnable return from org.eclipse.jetty.server.HttpChannel#onRequest(MetaData.Request) has returned and the Callback passed to Handler#handle(Request, Response, Callback) has been completed).
protected abstract void
onRequestComplete(String
the ID of the request
requestId
,
long
the duration in nanoseconds of the completed request
durationInNs
)

Called back for each completed request with its execution's latency.

Inherited from org.eclipse.jetty.server.handler.EventsHandler:
handleonAfterHandlingonBeforeHandlingonRequestReadonResponseBeginonResponseTrailersCompleteonResponseWriteonResponseWriteComplete

Constructor Detail

LatencyRecordingHandlerback to summary
public LatencyRecordingHandler()
LatencyRecordingHandlerback to summary
public LatencyRecordingHandler(Handler handler)

Method Detail

onCompleteback to summary
protected final void onComplete(Request request, Throwable failure)

Overrides org.eclipse.jetty.server.handler.EventsHandler.onComplete.

Doc from org.eclipse.jetty.server.handler.EventsHandler.onComplete.

Invoked when the request and response processing are complete, just before the request and response will be recycled (i.e. after the Runnable return from org.eclipse.jetty.server.HttpChannel#onRequest(MetaData.Request) has returned and the Callback passed to Handler#handle(Request, Response, Callback) has been completed).

Parameters
request:Request

the request object. The read(), demand(Runnable) and fail(Throwable) methods must not be called by the listener.

failure:Throwable

if there was a failure to complete

Annotations
@Override
onRequestCompleteback to summary
protected abstract void onRequestComplete(String requestId, long durationInNs)

Called back for each completed request with its execution's latency.

Parameters
requestId:String

the ID of the request

durationInNs:long

the duration in nanoseconds of the completed request