public synchronized void close() { if( !isRunning ) { return; } // Gracefully let any connections know that the server is // going down. Without this, their connections will simply // error out. for( HostedConnection conn : server.getConnections() ) { conn.close("Server is shutting down."); } try { Thread.sleep(1000); // wait a couple beats to let the messages go out } catch( InterruptedException e ) { e.printStackTrace(); } server.close(); isRunning = false; notifyAll(); }
public void close() { if (server != null && server.isRunning()) { // Close the client connections gracefully for (HostedConnection conn : server.getConnections()) { conn.close("Server closing!"); } server.close(); // FIXME: Really, I'm sure this is not meant to be // https://hub.jmonkeyengine.org/t/solved-for-now-serializer-locked-error-what-does-it-mean-version-jme-3-1/33671 Serializer.setReadOnly(false); } }