Stop the in-process server and block until it has completely stopped.
Obviously must be called after {@link #start()}.
324990
public void shutdown() {
        for (Client client : trackedClients) {
            // best effort closing -- ignores many problems
            try {
                client.drain();
                client.close();
            }
            catch (Exception e) {}
        }
        loaderClient = null;

        try {
            server.shutdown();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        try {
            server.join(20000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
816876
protected function stop()
    {
        $pid = $this->getCurrentPid();

        if (! $this->isRunning($pid)) {
            $this->error("Failed! There is no swoole_http_server process running.");

            return;
        }

        $this->info('Stopping swoole http server...');

        $isRunning = $this->killProcess($pid, SIGTERM, 15);

        if ($isRunning) {
            $this->error('Unable to stop the swoole_http_server process.');

            return;
        }

        // I don't known why Swoole didn't trigger "onShutdown" after sending SIGTERM.
        // So we should manually remove the pid file.
        $this->removePidFile();

        $this->info('> success');
    }
1077851
@Override
    public synchronized void stop(final StopContext context) {
        final boolean shutdownServers = runningModeControl.getRestartMode() == RestartMode.SERVERS;
        if (shutdownServers) {
            Runnable task = new Runnable() {
                @Override
                public void run() {
                    try {
                        serverInventory.shutdown(true, -1, true); // TODO graceful shutdown
                        serverInventory = null;
                        // client.getValue().setServerInventory(null);
                    } finally {
                        serverCallback.getValue().setCallbackHandler(null);
                        context.complete();
                    }
                }
            };
            try {
                executorService.getValue().execute(task);
            } catch (RejectedExecutionException e) {
                task.run();
            } finally {
                context.asynchronous();
            }
        } else {
            // We have to set the shutdown flag in any case
            serverInventory.shutdown(false, -1, true);
            serverInventory = null;
        }
    }
885753
public void stop() {
    if (inputThread != null) {
      if (inputStreamPumper != null) {
        inputStreamPumper.stopProcessing();
      }
      // #33 Interrupt reading from a PipedInputStream to unblock the pumping thread
      inputThread.interrupt();
      log.trace("Joining input thread {}...", inputThread);
      try {
        inputThread.join();
        inputThread = null;
      }
      catch (InterruptedException e) {
        // ignore
      }
    }

    if (outputThread != null) {
      log.trace("Joining output thread {}...", outputThread);
      try {
        outputThread.join();
        outputThread = null;
      }
      catch (InterruptedException e) {
        // ignore
      }
    }

    if (errorThread != null) {
      log.trace("Joining error thread {}...", errorThread);
      try {
        errorThread.join();
        errorThread = null;
      }
      catch (InterruptedException e) {
        // ignore
      }
    }

    flush();
  }
954324
synchronized void stop(){
        if(status.equals("stopped"))
            return;
        long t = System.currentTimeMillis();
        run = false;

        try {
            serverSocket.close();
        } catch (IOException e) {
            throw S1SystemError.wrap(e);
        }

        executor.shutdown();
        while (!executor.isTerminated()) {
        }

        status = "stopped";
        LOG.info("Node "+nodeId+" file server stopped ("+(System.currentTimeMillis()-t)+" ms.)");
    }
699664
def stop(self):
        
        if self.is_run:
            self._service.shutdown()
            self._service.server_close()
657500
private static void stopAll()
    { 
        if (_configs!=null)
        {
            synchronized(_configs)
            {
                for(int i=0;i<_servers.size();i++)
                {
                    HttpServer server = (HttpServer)_servers.get(i);
                    try{server.stop();}catch(InterruptedException e){}
                }
            }
        }
    }
697556
public void stop() {
		
		if (!this.running.compareAndSet(true, false)) {
			return;
		}

		// wake up all connections
		synchronized (this.connections) {
			for (final Connection conn : this.connections.values()) {
				conn.interrupt();
			}
		}

		// wait until all connections are closed
		while (!this.connections.isEmpty()) {
			try {
				Thread.sleep(100);
			} catch (InterruptedException e) {
			}
		}
	}
291149
public void shutdown() {
    if (purgeThread != null) {
      WaitingRoomPurger purger = (WaitingRoomPurger) purgeThread.getRunnable();
      purger.shutdown();
    }

    RPC.stopProxy(namenode);
    if (server != null) server.stop();
  }
1053293
public void shutdown() {
	accept = false;
	try {
	    _server.close();
	} catch(Exception e) {}
	// this is a hack to ensue the server socket is
	// unblocked from accpet()
	// but this is not guaranteed to work still
        SocketFactory factory = SocketFactory.getDefault();
	Socket s = null;
	try {
	    s = factory.createSocket(InetAddress.getLocalHost(), getPort());
	    s.getInputStream();
	} catch (Exception e) {
	    // can be ignored
	} finally {
	    if (s != null) {
		try { s.close(); } catch (Exception e) {}
	    }
	}

	// reset everything
        serverThread = null;
        _server = null;
    }
380064
public final void stop() {
        if (this.thread != null) {
            try {
                if (this.thread != null) {
                    this.thread.interrupt();
                    synchronized (this.thread) {
                        this.thread.notifyAll();
                    }
                }
            } finally {
                this.thread = null;
            }
        }
    }
439763
public void stop() {
        Log.info(serverName() + " gracefully stopping...");
        for (EventLoopGroup g : eventLoopGroups) {
            g.shutdownGracefully().awaitUninterruptibly();
        }
        Log.info(serverName() + " gracefully stopped");
    }
1351180
@Override
  public void stop() throws IOException {
    if (jettyServer != null) {
      try {
        jettyServer.stop();
      } catch (IOException e) {
        throw e;
      } catch (Exception e) {
        throw new IOException(e);
      }
    }
  }
1045330
public synchronized void stop() {
    if (isStopped()) {
      throw new IllegalStateException("Failed to stop Socket.IO server: server already stopped");
    }

    log.info("Socket.IO server stopping");

    timer.stop();
    bootstrap.config().group().shutdownGracefully().syncUninterruptibly();
    state = State.STOPPED;

    log.info("Socket.IO server stopped");
  }
458016
function Server_stop() {
  if (!this._wsStarted) throw Error("server not started")
  if (this._wsStopped) return

  this._wsStopped = true

  sessions.shutDown()
  this._wsServer.shutDown()

  this._wsServer.removeListener("request", this._onRequest)
  this._wsServer.removeListener("connect", onConnect)

  self._wsConfig  = null
  self._wsServer  = null
}
543624
public void stopServer() {
        shouldRun = false;
        try {
            listener.close();
        } catch (IOException ex) {
            // Don't care
        }
        while (true) {
            synchronized (allWorkers) {
                if (allWorkers.isEmpty()) {
                    break;
                }
                for (Worker w : allWorkers) {
                    w.stopSocket();
                    w.interrupt();
                }
            }
        }

        try {
            listener.close();
        } catch (IOException ex) {
            ex.printStackTrace();
        }
    }
630500
@Write(consumes = {})
    public Object stop() {
        try {
            return message;
        } finally {
            Thread thread = new Thread(this::stopServer);
            thread.setContextClassLoader(getClass().getClassLoader());
            thread.start();
        }
    }