| Modifier and Type | Class and Description |
|---|---|
| private class |
| Modifier and Type | Field and Description |
|---|---|
| private final LongAdder | |
| private final Graceful. | |
| private static final Logger |
| Access | Constructor and Description |
|---|---|
| public | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| public long | |
| 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. |
| public boolean | Returns: whether the graceful shutdown has been initiatedImplements org. Flag indicating that Graceful shutdown has been initiated. |
| public CompletableFuture |
| _requests | back to summary |
|---|---|
| private final LongAdder _requests | |
| _shutdown | back to summary |
|---|---|
| private final Graceful. | |
| LOG | back to summary |
|---|---|
| private static final Logger LOG | |
| GracefulHandler | back to summary |
|---|---|
| public GracefulHandler() | |
| GracefulHandler | back to summary |
|---|---|
| public GracefulHandler(Handler handler) | |
| getCurrentRequestCount | back to summary |
|---|---|
public long getCurrentRequestCount()
| |
| 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;
}
| |
| isShutdown | back to summary |
|---|---|
| public boolean isShutdown() Implements org. Flag indicating that Graceful shutdown has been initiated. | |
| shutdown | back to summary |
|---|---|
| public CompletableFuture Implements org. Doc from org. Shutdown the component. When this method returns, the component should not accept any new load.
| |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv final Request | |
| pack-priv final Response |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void |
| request | back to summary |
|---|---|
| pack-priv final Request request | |
| response | back to summary |
|---|---|
| pack-priv final Response response | |
| ShutdownTrackingCallback | back to summary |
|---|---|
| public ShutdownTrackingCallback(Request request, Response response, Callback callback) | |
| completed | back to summary |
|---|---|
| public void completed() Overrides org. Implements org.
| |