Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jetty-users] Using StatisticsHandler for graceful shutdown


I have been trying to use the StatisticsHandler to enable graceful shutdown in Jetty 9.3. But to my dismay, it does not seem to be that straight forward. First of all, let me explain my environment. I am using multiple jetty modules (gzip, server, servlets, jsp, jstl, etc.) and every module is instantiated by its corresponding .ini file in start.d directory. I have set stopTimeout to be 15000 and stopAtShutdown as true. (in same way as in default jetty.xml)

To enable StatisticsHandler i tried the following methods:

1. added stats.ini file in start.d directory and the contents of the file were as follows:


   Even after adding the module and restarting jetty, when i stop jetty there is no graceful shutdown and it just stops immediately.

2. Then i tried adding the statistics handler in Jetty.xml as mentioned in the documentation. It was added as follows:

<Get id="oldhandler" name="handler" />
<Set name="handler">
  <New id="StatsHandler" class="org.eclipse.jetty.server.handler.StatisticsHandler">
    <Set name="handler"><Ref refid="oldhandler" /></Set>

But even then just restarting jetty didn't solve my problem. Can someone guide me about what I am doing wrong, or what needs to be done to enable graceful shutdown in jetty.

Thanks in advance.



Back to the top