Community
Participate
Working Groups
Build Identifier: 7.0.2.v20100331 Server#stop() calls ShutdownThread.deregister(this). This may be the first time the JVM sees "ShutdownThread", which adds a shutdown hook. If we do this inside of a shutdown hook, an ExceptionInInitializerError is thrown. It's easy enough to get the server itself to put in a shutdown hook which initializes ShutdownThread early enough that this doesn't happen. But, it shouldn't happen anyway. Reproducible: Always Steps to Reproduce: I create a very small embedded server: HandlerCollection handlers = new HandlerCollection(); ServletContextHandler root = new ServletContextHandler(handlers, "/", ServletContextHandler.NO_SESSIONS|ServletContextHandler.NO_SECURITY); root.addServlet(new ServletHolder(new MyServlet()), "/*"); Server server = new Server(main.options.port); server.setHandler(handlers); server.start(); Then I register my own shutdown hook, which among other things calls server.stop(). It throws ExceptionInInitializerError when it sees a static reference to ShutdownThread for the first time.
Duplicate of #311554
Added double exception handling for ShutdownThread if shutdown already commenced. r1774