public void restartHTTPServer() {
        Thread restartThread = new Thread(() -> {
            if (isStandAlone()) {
                // Restart the HTTP server manager. This covers the case
                // of changing the ports, as well as generating self-signed certificates.

                // Wait a short period before shutting down the admin console.
                // Otherwise, this page won't render properly!
                try {
                    Thread.sleep(1000);
                    pluginManager.getPluginByCanonicalName("admin").ifPresent(plugin -> ((AdminConsolePlugin) plugin).restart());
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        });
        restartThread.setContextClassLoader(loader);
        restartThread.start();
    }
Restarts the HTTP server only when running in stand alone mode. The restart
process will be done in another thread that will wait 1 second before doing
the actual restart. The delay will give time to the page that requested the
restart to fully render its content.
xmppserver/src/main/java/org/jivesoftware/openfire/XMPPServer.java