Destroy a stopped server.
Remove all components and send notifications to all event
listeners. The HttpServer must be stopped before it can be destroyed.
775255
public void destroy()
    {
        __servers.remove(this);
        if (isStarted())
            throw new IllegalStateException("Started");
        if (_listeners!=null)
            _listeners.clear();
        _listeners=null;
        if (_virtualHostMap!=null)
            _virtualHostMap.clear();
        _virtualHostMap=null;
        _notFoundContext=null;

        super.destroy();
    }
1284608
def terminate(self):
    """"""
    # Tear down the Pailgun TCPServer.
    if self.pailgun:
      self.pailgun.server_close()

    super(PailgunService, self).terminate()
404776
public void stopServer() {
        if (this.jmxConnectorServer == null) {
            this.logger.info("No JMXConnectorServer to stop");
            return;
        }

        try {
            try {
                this.jmxConnectorServer.stop();
                this.logger.info("Stopped JMXConnectorServer");
            } catch (IOException ioe) {
                throw new IllegalStateException("Failed to stop the JMXConnectorServer", ioe);
            }

            this.jmxConnectorServer = null;
        } catch (RuntimeException re) {
            if (this.failOnException) {
                throw re;
            }

            this.logger.error("Failed to shutdown the JMX Server", re);
        }
    }
959605
def cleanup(self):
        

        # if an event broker has been created for this service
        if self.event_broker:
            # stop the event broker
            self.event_broker.stop()
        # attempt
        try:
            # close the http server
            self._server_handler.close()
            self.loop.run_until_complete(self._server_handler.wait_closed())
            self.loop.run_until_complete(self._http_handler.finish_connections(shutdown_timeout))

        # if there was no handler
        except AttributeError:
            # keep going
            pass

        # more cleanup
        self.loop.run_until_complete(self.app.shutdown())
        self.loop.run_until_complete(self.app.cleanup())
900774
public void stop(BundleContext context) throws Exception {
        if (!checkConfig(context)) {
            return;
        }

        if (monitoringService == null) {
            initWsClient(context);
        }

        EventType serverStopEvent = createEventType(EventEnumType.SERVER_STOP);
        putEvent(serverStopEvent);

        LOG.info("Send SERVER_STOP event to SAM Server successful!");
    }
688697
def stop(self, *args, **kwargs):
        
        if args:
            LOG.debug("args: %s" % str(args))
        if kwargs:
            LOG.debug("kwargs: %s" % str(kwargs))
        try:
            self._server.stop()
            self._server = None

            # Device-storage clear
            self.devices.clear()
            self.devices_all.clear()
            self.devices_raw.clear()
            self.devices_raw_dict.clear()

            return True
        except Exception as err:
            LOG.critical("Failed to stop server")
            LOG.debug(str(err))
            return False
351966
public void removeServer(InternalInstrumented<ServerStats> server) {
    remove(servers, server);
    ServerSocketMap prev = perServerSockets.remove(id(server));
    assert prev != null;
    assert prev.isEmpty();
  }
754750
function destroy() {
    if (!this.socket) return false;

    this.emit('destroy');

    this.socket.abort();
    this.removeAllListeners();

    this.headers = {};
    this.socket = null;
    this.body = null;

    delete Requests.active[this.id];

    return true;
  }
918862
static public void shutdown() {

        // need to unregister the service
        if (getServerConfig().enableRegistry && registry != null && serviceUrls != null) {
            for(URL serviceUrl: serviceUrls) {
                registry.unregister(serviceUrl);
                // Please don't remove the following line. When server is killed, the logback won't work anymore.
                // Even debugger won't reach this point; however, the logic is executed successfully here.
                System.out.println("unregister serviceUrl " + serviceUrl);
                if (logger.isInfoEnabled())
                    logger.info("unregister serviceUrl " + serviceUrl);
            }
        }

        if (gracefulShutdownHandler != null) {
            logger.info("Starting graceful shutdown.");
            gracefulShutdownHandler.shutdown();
            try {
                gracefulShutdownHandler.awaitShutdown(60 * 1000);
            } catch (InterruptedException e) {
                logger.error("Error occurred while waiting for pending requests to complete.", e);
            }
            logger.info("Graceful shutdown complete.");
        }

        ShutdownHookProvider[] shutdownHookProviders = SingletonServiceFactory.getBeans(ShutdownHookProvider.class);
        if (shutdownHookProviders != null)
            Arrays.stream(shutdownHookProviders).forEach(s -> s.onShutdown());

        stop();
        logger.info("Cleaning up before server shutdown");
    }
1235198
def stop_and_destroy(self, sync=True):
        
        def _self_destruct():
            """destroy the server and all storages attached to it."""

            # try_it_n_times util is used as a convenience because
            # Servers and Storages can fluctuate between "maintenance" and their
            # original state due to several different reasons especially when
            # destroying infrastructure.

            # first destroy server
            try_it_n_times(operation=self.destroy,
                           expected_error_codes=['SERVER_STATE_ILLEGAL'],
                           custom_error='destroying server failed')

            # storages may be deleted instantly after server DELETE
            for storage in self.storage_devices:
                try_it_n_times(operation=storage.destroy,
                               expected_error_codes=['STORAGE_STATE_ILLEGAL'],
                               custom_error='destroying storage failed')

        if sync:
            self.populate()

        # server is either starting or stopping (or error)
        if self.state in ['maintenance', 'error']:
            self._wait_for_state_change(['stopped', 'started'])

        if self.state == 'started':
            try_it_n_times(operation=self.stop,
                           expected_error_codes=['SERVER_STATE_ILLEGAL'],
                           custom_error='stopping server failed')

            self._wait_for_state_change(['stopped'])

        if self.state == 'stopped':
            _self_destruct()
        else:
            raise Exception('unknown server state: ' + self.state)
895934
function stop(callback) {
    if (httpServer) {
        DEBUG && debug('stop http server');
        try {
            httpServer.close();
        } catch (e) {
        }
        httpServer = null;
    } else {
        DEBUG && debug('***ignore*** http server is not running!');
    }
    callback && callback(false);
}
298565
public synchronized boolean stopServer() {

        if (!isProxyRunning) {
            return false;
        }

        isProxyRunning = false;
        HttpUtil.closeServerSocket(proxySocket);

        try {
            thread.join();   //(PORT_TIME_OUT);
            
        } catch (Exception e) {
        }

        proxySocket = null;

        return true;
    }
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.)");
    }
69994
def stop_service
      DRb.remove_server(self)
      if  Thread.current['DRb'] && Thread.current['DRb']['server'] == self
        Thread.current['DRb']['stop_service'] = true
      else
        @thread.kill
      end
    end
278778
def stop(self):
        

        # Stopping the server will cause its `serve_forever()` method
        # to return, which will cause the server thread to terminate.
        # TODO: Describe how the processing threads terminate.

        if self._http_server:
            self._http_server.shutdown()
            self._http_server.server_close()
            self._http_server = None
            self._http_thread = None

        if self._https_server:
            self._https_server.shutdown()
            self._https_server.server_close()
            self._https_server = None
            self._https_thread = None
1075347
public void stopServer()
    {
        Log(Level.INFO, "Attempting to stop SocketServer");
        keepRunning = false;
        // Thread will be blocked waiting for input - unblock it by closing the socket underneath it:
        if (this.serverSocket != null)
        {
            try
            {
                this.serverSocket.close();
            }
            catch (IOException e)
            {
                Log(Level.WARNING, "Something happened when closing SocketServer: " + e);
            }
            this.serverSocket = null;
        }
    }
398400
public final void destroy() throws JMException {
        synchronized (mBeanHandles) {
            List<JMException> exceptions = new ArrayList<JMException>();
            List<MBeanHandle> unregistered = new ArrayList<MBeanHandle>();
            for (MBeanHandle handle : mBeanHandles) {
                try {
                    unregistered.add(handle);
                    handle.server.unregisterMBean(handle.objectName);
                } catch (InstanceNotFoundException e) {
                    exceptions.add(e);
                } catch (MBeanRegistrationException e) {
                    exceptions.add(e);
                }
            }
            // Remove all successfully unregistered handles
            mBeanHandles.removeAll(unregistered);

            // Throw error if any exception occured during unregistration
            if (exceptions.size() == 1) {
                throw exceptions.get(0);
            } else if (exceptions.size() > 1) {
                StringBuilder ret = new StringBuilder();
                for (JMException e : exceptions) {
                    ret.append(e.getMessage()).append(", ");
                }
                throw new JMException(ret.substring(0, ret.length() - 2));
            }
        }

        // Unregister any notification listener
        mBeanServerManager.destroy();
    }