Package org.jboss.as.domain.http.server
Class ManagementHttpRequestProcessor
- java.lang.Object
-
- org.jboss.as.domain.http.server.ManagementHttpRequestProcessor
-
- All Implemented Interfaces:
org.jboss.as.protocol.mgmt.support.ManagementChannelShutdownHandle
public class ManagementHttpRequestProcessor extends Object implements org.jboss.as.protocol.mgmt.support.ManagementChannelShutdownHandle
This class tracks active http management requests and provides listeners to coordinate the shutdown of the server. Its main purpose is in conjunction with theHttpShutdownServiceand theManagementRequestTracker, which prevent the http server from closing the connections before all active operations completed.- Author:
- Emanuel Muckenhuber
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceManagementHttpRequestProcessor.ShutdownListener
-
Constructor Summary
Constructors Constructor Description ManagementHttpRequestProcessor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddShutdownListener(ManagementHttpRequestProcessor.ShutdownListener listener)Add a shutdown listener, which gets called when all requests completed on shutdown.booleanawaitCompletion(long timeout, TimeUnit unit)protected booleanbeginRequest()This gets called when we receive a new http mgmt request and returns whether the request can process or should return a503response when the server is about to shutdown.protected voidendRequest()End a request and call thehandleCompleted()if the server is shutdown and there are no more active requests.protected voidhandleCompleted()Notify all shutdown listeners that the shutdown completed.voidshutdown()voidshutdownNow()
-
-
-
Method Detail
-
shutdown
public void shutdown()
- Specified by:
shutdownin interfaceorg.jboss.as.protocol.mgmt.support.ManagementChannelShutdownHandle
-
shutdownNow
public void shutdownNow()
- Specified by:
shutdownNowin interfaceorg.jboss.as.protocol.mgmt.support.ManagementChannelShutdownHandle
-
awaitCompletion
public boolean awaitCompletion(long timeout, TimeUnit unit) throws InterruptedException- Specified by:
awaitCompletionin interfaceorg.jboss.as.protocol.mgmt.support.ManagementChannelShutdownHandle- Throws:
InterruptedException
-
addShutdownListener
public void addShutdownListener(ManagementHttpRequestProcessor.ShutdownListener listener)
Add a shutdown listener, which gets called when all requests completed on shutdown.- Parameters:
listener- the shutdown listener
-
handleCompleted
protected void handleCompleted()
Notify all shutdown listeners that the shutdown completed.
-
beginRequest
protected boolean beginRequest()
This gets called when we receive a new http mgmt request and returns whether the request can process or should return a503response when the server is about to shutdown.- Returns:
trueif the request can be processed;falseif the server is about to shut down
-
endRequest
protected void endRequest()
End a request and call thehandleCompleted()if the server is shutdown and there are no more active requests.
-
-