Class 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 the HttpShutdownService and the ManagementRequestTracker, which prevent the http server from closing the connections before all active operations completed.
    Author:
    Emanuel Muckenhuber
    • Constructor Detail

      • ManagementHttpRequestProcessor

        public ManagementHttpRequestProcessor()
    • Method Detail

      • shutdown

        public void shutdown()
        Specified by:
        shutdown in interface org.jboss.as.protocol.mgmt.support.ManagementChannelShutdownHandle
      • shutdownNow

        public void shutdownNow()
        Specified by:
        shutdownNow in interface org.jboss.as.protocol.mgmt.support.ManagementChannelShutdownHandle
      • awaitCompletion

        public boolean awaitCompletion​(long timeout,
                                       TimeUnit unit)
                                throws InterruptedException
        Specified by:
        awaitCompletion in interface org.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 a 503 response when the server is about to shutdown.
        Returns:
        true if the request can be processed; false if the server is about to shut down
      • endRequest

        protected void endRequest()
        End a request and call the handleCompleted() if the server is shutdown and there are no more active requests.