| Modifier and Type | Class and Description |
|---|---|
| public static class | StatisticsHandler.MinimumDataRateHandler
Checks that the wrapped handler can read/write at a minimal rate of N bytes per second. |
| Modifier and Type | Field and Description |
|---|---|
| private final LongAdder | |
| private final LongAdder | |
| private final LongAdder | |
| private final CounterStatistic | |
| private final SampleStatistic | |
| private final LongAdder | |
| private final CounterStatistic | |
| private final SampleStatistic | |
| private final LongAdder | |
| private final LongAdder | |
| private final LongAdder | |
| private final LongAdder | |
| private final LongAdder | |
| private long |
| Access | Constructor and Description |
|---|---|
| public | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| protected void | doStart()
Overrides org. |
| public void | dump(Appendable
The appendable to dump to out, String The indent to apply after any new lines. indent)Overrides org. Implements org. |
| public long | |
| public long | |
| public int | |
| public int | |
| public int | |
| public long | |
| public double | |
| public double | |
| public long | |
| public int | |
| public int | |
| public int | |
| public int | |
| public int | |
| public long | |
| public double | |
| public double | |
| public long | |
| public int | |
| public int | |
| public int | |
| public int | |
| public int | |
| public int | |
| public Duration | |
| protected void | onAfterHandling(Request
the request object. The request, boolean read(), demand(Runnable) and fail(Throwable) methods must not be called by the listener.if the server handlers handled the request handled, Throwable the exception thrown by the application failure)Overrides org. Runnable returned from
org. returns).
|
| protected void | onBeforeHandling(Request
the request object. The request)read(), demand(Runnable) and fail(Throwable) methods must not be called by the listener.Overrides org. Runnable
returned from org. is run).
|
| protected void | onComplete(Request
the request object. The request, Throwable read(), demand(Runnable) and fail(Throwable) methods must not be called by the listener.if there was a failure to complete failure)Overrides org. Runnable return from org.
has returned and the Callback passed to Handler#handle(Request, Response, Callback)
has been completed).
|
| protected void | onRequestRead(Request
the request object. The request, Content.read(), demand(Runnable) and fail(Throwable) methods must not be called by the listener.a potentially null request content chunk, including chunkerror
and org. chunks.
If a reference to the chunk (or its ByteBuffer) is kept,
then Content. must be called.Overrides org. Request#read()).
|
| protected void | onResponseBegin(Request
the request object. The request, int read(), demand(Runnable) and fail(Throwable) methods must not be called by the listener.the response status status, HttpFields the immutable fields of the response object headers)Overrides org. Response#write(boolean, ByteBuffer, Callback)).
|
| protected void | onResponseWrite(Request
the request object. The request, boolean read(), demand(Runnable) and fail(Throwable) methods must not be called by the listener.indicating last write last, ByteBuffer The content)ByteBuffer of the response content chunk (readonly).Overrides org. Response#write(boolean, ByteBuffer, Callback)).
|
| public void |
| _bytesRead | back to summary |
|---|---|
| private final LongAdder _bytesRead | |
| _bytesWritten | back to summary |
|---|---|
| private final LongAdder _bytesWritten | |
| _failures | back to summary |
|---|---|
| private final LongAdder _failures | |
| _handleStats | back to summary |
|---|---|
| private final CounterStatistic _handleStats | |
| _handleTimeStats | back to summary |
|---|---|
| private final SampleStatistic _handleTimeStats | |
| _handlingFailures | back to summary |
|---|---|
| private final LongAdder _handlingFailures | |
| _requestStats | back to summary |
|---|---|
| private final CounterStatistic _requestStats | |
| _requestTimeStats | back to summary |
|---|---|
| private final SampleStatistic _requestTimeStats | |
| _responses1xx | back to summary |
|---|---|
| private final LongAdder _responses1xx | |
| _responses2xx | back to summary |
|---|---|
| private final LongAdder _responses2xx | |
| _responses3xx | back to summary |
|---|---|
| private final LongAdder _responses3xx | |
| _responses4xx | back to summary |
|---|---|
| private final LongAdder _responses4xx | |
| _responses5xx | back to summary |
|---|---|
| private final LongAdder _responses5xx | |
| _startTime | back to summary |
|---|---|
| private long _startTime | |
| StatisticsHandler | back to summary |
|---|---|
| public StatisticsHandler() | |
| StatisticsHandler | back to summary |
|---|---|
| public StatisticsHandler(Handler handler) | |
| doStart | back to summary |
|---|---|
| protected void doStart() throws Exception Overrides org. Doc from org. Starts the managed lifecycle beans in the order they were added.
| |
| dump | back to summary |
|---|---|
| public void dump(Appendable out, String indent) throws IOException Overrides org. Implements org. Doc from org. Dump this object (and children) into an Appendable using the provided indent after any new lines. The indent should not be applied to the first object dumped.
| |
| getBytesRead | back to summary |
|---|---|
public long getBytesRead()
| |
| getBytesWritten | back to summary |
|---|---|
public long getBytesWritten()
| |
| getFailures | back to summary |
|---|---|
public int getFailures()
| |
| getHandleActive | back to summary |
|---|---|
public int getHandleActive()
| |
| getHandleActiveMax | back to summary |
|---|---|
public int getHandleActiveMax()
| |
| getHandleTimeMax | back to summary |
|---|---|
public long getHandleTimeMax()
| |
| getHandleTimeMean | back to summary |
|---|---|
public double getHandleTimeMean()
| |
| getHandleTimeStdDev | back to summary |
|---|---|
public double getHandleTimeStdDev()
| |
| getHandleTimeTotal | back to summary |
|---|---|
public long getHandleTimeTotal()
| |
| getHandleTotal | back to summary |
|---|---|
public int getHandleTotal()
| |
| getHandlingFailures | back to summary |
|---|---|
public int getHandlingFailures()
| |
| getRequests | back to summary |
|---|---|
| public int getRequests()
Deprecated use
| |
| getRequestsActive | back to summary |
|---|---|
public int getRequestsActive()
| |
| getRequestsActiveMax | back to summary |
|---|---|
public int getRequestsActiveMax()
| |
| getRequestTimeMax | back to summary |
|---|---|
public long getRequestTimeMax()
| |
| getRequestTimeMean | back to summary |
|---|---|
public double getRequestTimeMean()
| |
| getRequestTimeStdDev | back to summary |
|---|---|
public double getRequestTimeStdDev()
| |
| getRequestTimeTotal | back to summary |
|---|---|
public long getRequestTimeTotal()
| |
| getRequestTotal | back to summary |
|---|---|
public int getRequestTotal()
| |
| getResponses1xx | back to summary |
|---|---|
public int getResponses1xx()
| |
| getResponses2xx | back to summary |
|---|---|
public int getResponses2xx()
| |
| getResponses3xx | back to summary |
|---|---|
public int getResponses3xx()
| |
| getResponses4xx | back to summary |
|---|---|
public int getResponses4xx()
| |
| getResponses5xx | back to summary |
|---|---|
public int getResponses5xx()
| |
| getStatisticsDuration | back to summary |
|---|---|
public Duration getStatisticsDuration()
| |
| onAfterHandling | back to summary |
|---|---|
| protected void onAfterHandling(Request request, boolean handled, Throwable failure) Overrides org. Doc from org. Invoked after application handling (i.e. just after the call to the | |
| onBeforeHandling | back to summary |
|---|---|
| protected void onBeforeHandling(Request request) Overrides org. Doc from org. Invoked just before calling the server handler tree (i.e. just before the This is the final state of the request before the handlers are called. This includes any request customization. | |
| onComplete | back to summary |
|---|---|
| protected void onComplete(Request request, Throwable failure) Overrides org. Doc from org. Invoked when the request and response processing are complete,
just before the request and response will be recycled (i.e. after the
| |
| onRequestRead | back to summary |
|---|---|
| protected void onRequestRead(Request request, Content. Overrides org. Doc from org. Invoked every time a request content chunk has been parsed, just before
making it available to the application (i.e. from within a call to
| |
| onResponseBegin | back to summary |
|---|---|
| protected void onResponseBegin(Request request, int status, HttpFields headers) Overrides org. Doc from org. Invoked just before the response is line written to the network (i.e. from
within the first call to
| |
| onResponseWrite | back to summary |
|---|---|
| protected void onResponseWrite(Request request, boolean last, ByteBuffer content) Overrides org. Doc from org. Invoked before each response content chunk has been written (i.e. from
within the any call to
| |
| reset | back to summary |
|---|---|
public void reset()
| |
| Modifier and Type | Class and Description |
|---|---|
| protected class | |
| protected class |
| Modifier and Type | Field and Description |
|---|---|
| private final long | |
| private final long |
| Access | Constructor and Description |
|---|---|
| public | MinimumDataRateHandler(long
the minimum number of bytes to be read per second, or 0 for not checking the read rate. minimumReadRate, long the minimum number of bytes to be written per second, or 0 for not checking the write rate. minimumWriteRate)Creates a |
| public | MinimumDataRateHandler(Handler
the handler to wrap. handler, long the minimum number of bytes to be read per second, or 0 for not checking the read rate. minimumReadRate, long the minimum number of bytes to be written per second, or 0 for not checking the write rate. minimumWriteRate)Creates a |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | handle(Request
the HTTP request to handle request, Response the HTTP response to handle response, Callback the callback to complete when the handling is complete callback)Overrides org. Implements org. Invoked to handle the passed HTTP request and response. |
| _minimumReadRate | back to summary |
|---|---|
| private final long _minimumReadRate | |
| _minimumWriteRate | back to summary |
|---|---|
| private final long _minimumWriteRate | |
| MinimumDataRateHandler | back to summary |
|---|---|
| public MinimumDataRateHandler(long minimumReadRate, long minimumWriteRate) Creates a
| |
| MinimumDataRateHandler | back to summary |
|---|---|
| public MinimumDataRateHandler(Handler handler, long minimumReadRate, long minimumWriteRate) Creates a
| |
| handle | back to summary |
|---|---|
| public boolean handle(Request request, Response response, Callback callback) throws Exception Overrides org. Implements org. Doc from org. Invoked to handle the passed HTTP request and response. The request is accepted by returning true, then handling must be concluded by completing the passed callback. The handling may be asynchronous, i.e. this method may return true and complete the given callback later, possibly from a different thread. If this method returns false, then the callback must not be invoked and any mutation on the response reversed. Exceptions thrown by this method may be subsequently handled by an error The simplest implementation is:
public boolean handle(Request request, Response response, Callback callback)
{
callback.succeeded();
return true;
}
A HelloWorld implementation is:
public boolean handle(Request request, Response response, Callback callback)
{
response.write(true, ByteBuffer.wrap("Hello World\n".getBytes(StandardCharsets.UTF_8)), callback);
return true;
}
| |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| private long | |
| public void | demand(Runnable
the demand callback to invoke when there is a content chunk available. demandCallback)Overrides org. Implements org. Demands to invoke the given demand callback parameter when a chunk of content is available. |
| public Content. | read()
Overrides org. Implements org. Reads a chunk of content. |
| _errorContent | back to summary |
|---|---|
| private Content. | |
| MinimumDataRateRequest | back to summary |
|---|---|
| private MinimumDataRateRequest(Request request) | |
| dataRatePerSecond | back to summary |
|---|---|
| private long dataRatePerSecond(long dataCount) | |
| demand | back to summary |
|---|---|
| public void demand(Runnable demandCallback) Overrides org. Implements org. Doc from org. Demands to invoke the given demand callback parameter when a chunk of content is available. See how to use this method idiomatically. Implementations guarantee that calls to this method are safely reentrant so that
stack overflows are avoided in the case of mutual recursion between the execution of
the The demand callback may be invoked spuriously: a subsequent call to Calling this method establishes a pending demand, which is fulfilled when the demand callback is invoked. Calling this method when there is already a pending demand results in an
If the invocation of the demand callback throws an exception, then | |
| read | back to summary |
|---|---|
| public Content. Overrides org. Implements org. Doc from org. Reads a chunk of content. See how to use this method idiomatically. The returned chunk could be:
Once a read returns an Once a read returns a The content reader code must ultimately arrange for a call to
Additionally, prior to the ultimate call to Concurrent reads from different threads are not recommended, as they are inherently in a race condition. Reads performed outside the invocation context of a
In addition, the returned
| |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public StatisticsHandler. | |
| public void | write(boolean
whether the ByteBuffer is the last to write last, ByteBuffer the ByteBuffer to write byteBuffer, Callback the callback to notify when the write operation is complete callback)Overrides org. Implements org. Writes the given |
| MinimumDataRateResponse | back to summary |
|---|---|
| public MinimumDataRateResponse(StatisticsHandler. | |
| getRequest | back to summary |
|---|---|
| public StatisticsHandler. Overrides org. Implements org.
| |
| write | back to summary |
|---|---|
| public void write(boolean last, ByteBuffer byteBuffer, Callback callback) Overrides org. Implements org. Doc from org. Writes the given Implementations guarantee that calls to this method are safely reentrant so that
stack overflows are avoided in the case of mutual recursion between the execution of
the The invocation of the passed Thus a
| |