Add logging of server shutdown
@@ -307,7 +307,9 @@ public class JettyHttpServer extends AbstractServerProvider {
@Override
public void close() {
try {
+ log.log(Level.INFO, String.format("Shutting down server (graceful=%b)", isGracefulShutdownEnabled()));
server.stop();
+ log.log(Level.INFO, "Server shutdown completed");
} catch (final Exception e) {
log.log(Level.SEVERE, "Server shutdown threw an unexpected exception.", e);
}
@@ -316,6 +318,10 @@ public class JettyHttpServer extends AbstractServerProvider {
janitor.shutdown();
}
+ private boolean isGracefulShutdownEnabled() {
+ return server.getChildHandlersByClass(StatisticsHandler.class).length > 0 && server.getStopTimeout() > 0;
+ }
+
public int getListenPort() {
return ((ServerConnector)server.getConnectors()[0]).getLocalPort();
}
