code: public void shutdown() {
      if (shutdown.getAndSet(true)) {
        return;
      }
  
      // NGServer main thread might be blocking on socket in `accept()`, so we close the socket
      // here to unblock it and finish gracefully
      try {
        serversocket.close();
      } catch (Throwable ex) {
        LOG.log(Level.WARNING, "Exception closing server socket on Nailgun server shutdown", ex);
      }
    }
docs: Shuts down the server. The server will stop listening and its thread will finish. Any running
  nails will be allowed to finish.
  
  <p>Any nails that provide a
  
  <pre><code>public static void nailShutdown(NGServer)</code></pre>
  
  method will have this method called with this NGServer as its sole parameter.