A colleague told me that the ServletContextHandler needs to be wrapped in a StatisticsHandler to know if the connections are busy or not. Without this the server will still shut down immediately.
With the existing code it would look like this:
HandlerWrapper statisticsHandler = new StatisticsHandler();
statisticsHandler.setHandler(createContextHandler());
server.setHandler(statisticsHandler);
https://github.com/mdhtr/java-webapplication/blob/ce371b12d0ebc271e0a225f9951e2bad35b41fef/src/main/java/mdhtr/webapplication/JettyServer.java#L50
A colleague told me that the ServletContextHandler needs to be wrapped in a StatisticsHandler to know if the connections are busy or not. Without this the server will still shut down immediately.
With the existing code it would look like this: