public class ManagementHttpRequestProcessor extends Object implements ManagementChannelInitialization.ManagementChannelShutdownHandle
HttpShutdownService
and the ManagementRequestTracker
,
which prevent the http server from closing the connections before all active operations completed.Modifier and Type | Class and Description |
---|---|
static interface |
ManagementHttpRequestProcessor.ShutdownListener |
Constructor and Description |
---|
ManagementHttpRequestProcessor() |
Modifier and Type | Method and Description |
---|---|
void |
addShutdownListener(ManagementHttpRequestProcessor.ShutdownListener listener)
Add a shutdown listener, which gets called when all requests completed on shutdown.
|
boolean |
awaitCompletion(long timeout,
TimeUnit unit)
Await the completion of all currently active operations.
|
protected boolean |
beginRequest()
This gets called when we receive a new http mgmt request and returns whether
the request can process or should return a
503 response when the server
is about to shutdown. |
protected void |
endRequest()
End a request and call the
handleCompleted() if the server is
shutdown and there are no more active requests. |
protected void |
handleCompleted()
Notify all shutdown listeners that the shutdown completed.
|
void |
shutdown()
Don't allow new operations, but still allow requests for existing ones.
|
void |
shutdownNow()
This will attempt to cancel all active operations, without waiting for their completion.
|
public void shutdown()
ManagementChannelInitialization.ManagementChannelShutdownHandle
This method does not wait for previously submitted operations to be
completed. Use awaitCompletion
to do that.
shutdown
in interface ManagementChannelInitialization.ManagementChannelShutdownHandle
public void shutdownNow()
ManagementChannelInitialization.ManagementChannelShutdownHandle
shutdownNow
in interface ManagementChannelInitialization.ManagementChannelShutdownHandle
public boolean awaitCompletion(long timeout, TimeUnit unit) throws InterruptedException
ManagementChannelInitialization.ManagementChannelShutdownHandle
awaitCompletion
in interface ManagementChannelInitialization.ManagementChannelShutdownHandle
timeout
- the timeoutunit
- the time unitfalse
if the timeout was reached and there were still active operationsInterruptedException
public void addShutdownListener(ManagementHttpRequestProcessor.ShutdownListener listener)
listener
- the shutdown listenerprotected void handleCompleted()
protected boolean beginRequest()
503
response when the server
is about to shutdown.true
if the request can be processed; false
if the server is about to shut downprotected void endRequest()
handleCompleted()
if the server is
shutdown and there are no more active requests.Copyright © 2023 JBoss by Red Hat. All rights reserved.