Start the connection shutdown process, cancelling any active
        consuming and closing the channel if the connection is not active.
554003
def shutdown(self):
        
        if self.is_shutting_down:
            self.logger.debug('Already shutting down')
            return

        self.set_state(self.STATE_SHUTTING_DOWN)
        self.logger.debug('Shutting down connection')
        if not self.is_active:
            return self.channel.close()
        self.logger.debug('Sending a Basic.Cancel to RabbitMQ')
        self.channel.basic_cancel(self.on_consumer_cancelled,
                                  self.consumer_tag)
1126610
public static void shutdown() {
        try {
            Connections.shutdown();
        } catch (final Exception e) {
            LOGGER.log(Level.ERROR, "Shutdown redis connection pool failed", e);
        }
    }
1352050
public void shutdown() {
    if (this.shuttingDown.getAndSet(true)) {
      // Already being shut down
      LOG.warn("DataNode.shutdown() was called while shutting down.");
      return;
    }
    if (infoServer != null) {
      try {
        infoServer.stop();
      } catch (Exception e) {
        LOG.warn("Exception shutting down DataNode", e);
      }
    }
    if (ipcServer != null) {
      ipcServer.stop();
    }
    this.shouldRun = false;
    if (dataXceiverServer != null) {
      ((DataXceiverServer) this.dataXceiverServer.getRunnable()).kill();
      this.dataXceiverServer.interrupt();

      // wait for all data receiver threads to exit
      if (this.threadGroup != null) {
        int retries = 0;
        while (true) {
          this.threadGroup.interrupt();
          LOG.info("Waiting for threadgroup to exit, active threads is " +
                   this.threadGroup.activeCount());
          if (this.threadGroup.activeCount() == 0) {
            break;
          }
          try {
            if (++retries > 600) {
              Thread[] activeThreads = new Thread[this.threadGroup.activeCount()];
              this.threadGroup.enumerate(activeThreads, true);
              LOG.info("Active Threads: " + Arrays.toString(activeThreads));
              LOG.warn("Waited for ThreadGroup to be empty for 10 minutes." + 
                        " SHUTTING DOWN NOW");
              break;
            }
            Thread.sleep(1000);
          } catch (InterruptedException e) {}
        }
      }
      // wait for dataXceiveServer to terminate
      try {
        this.dataXceiverServer.join();
      } catch (InterruptedException ie) {
      }
    }
    
    if (blockCopyExecutor != null && !blockCopyExecutor.isShutdown()) {
      blockCopyExecutor.shutdownNow();
    }
    
    if (namespaceManager != null) {
      namespaceManager.shutDownAll();
    }
    
    if (blockScanner != null) { 
      blockScanner.shutdown();
    }
    if(directoryScanner != null) {
      shutdownDirectoryScanner();
    }
    if (storage != null) {
      try {
        this.storage.unlockAll();
      } catch (IOException ie) {
      }
    }
    if (data != null) {
      data.shutdown();
    }
    if (myMetrics != null) {
      setCountingLoggers(null);
      myMetrics.shutdown();
    }
    this.shutdownMXBean();
  }
607049
def shutdown(self):
        
        self._handlertask.cancel()

        if self._timeout_handler:
            self._timeout_handler.cancel()
        self._transport = None
        self._stream_reader = None
        self._stream_writer.close()
        for i, task in self.tasks.items():
            task.cancel()
        self._stream_writer = None
        logger.info("close connection with {}".format(
            self._remote_host
        ))
1239668
public void shutdown() {
        if (open == 0 || shutdown) {
            return;
        }
        shutdown = true;
        sink.getIoThread().execute(new Runnable() {
            @Override
            public void run() {

                synchronized (ServerSentEventConnection.this) {
                    if (queue.isEmpty() && pooled == null) {
                        exchange.endExchange();
                    }
                }
            }
        });
    }
20215
public synchronized void shutdown() {
    // mark this as no longer running
    active = false;

    // close the socket
    try {
      if (socketNode != null) {
        socketNode.close();
        socketNode = null;
      }
    } catch (Exception e) {
      getLogger().info("Excpetion closing socket", e);
      // ignore for now
    }

    // stop the connector
    if (connector != null) {
      connector.interrupted = true;
      connector = null;  // allow gc
    }
    if (advertiseViaMulticastDNS) {
        zeroConf.unadvertise();
    }
  }
943270
public void stop() {
    if (LOG.isDebugEnabled()) {
      LOG.debug("Stopping client");
    }

    if (!running.compareAndSet(true, false)) {
      return;
    }
    
    synchronized (connections) {
      // wake up all connections
      for (Connection conn : connections.values()) {
        conn.interrupt();
      }
      // wait until all connections are closed
      while (!connections.isEmpty()) {
        try {
          connections.wait();
        } catch (InterruptedException e) {
          // pass
        }
      }
    }
  }
1297296
def shutdown(self) -> None:
        
        self._is_handshake_completed = False
        try:
            self._flush_ssl_engine()
        except IOError:
            # Ensure shutting down the connection never raises an exception
            pass

        try:
            self._ssl.shutdown()
        except OpenSSLError as e:
            # Ignore "uninitialized" exception
            if 'SSL_shutdown:uninitialized' not in str(e) and 'shutdown while in init' not in str(e):
                raise
        if self._sock:
            self._sock.close()
219499
def stop_consuming(self):
        
        if self._channel:
            self._logger.info('Sending a Basic.Cancel RPC command to RabbitMQ')
            self._channel.basic_cancel(self.on_cancelok, self._consumer_tag)
192602
def close_connection(self):
        """"""
        self._logger.info('Closing connection')
        self._closing = True
        self._connection.close()
639481
def _shutdown(self):
        
        for exit_handler in self._exit_handlers:
            exit_handler()

        if self._socket:
            self._socket.close()
            self._socket = None
1278901
def close(self):
        """"""
        if not self.is_running:
            return

        self._state = CLOSED
        self.logger.debug('closing connection(s)')

        while True:
            try:
                conn = self._connections.get(block=False)
            except Empty:
                break

            conn.close_stream()

        self.on_close.send(self)
884894
public void stop() {
			if (this.channels.size() > 0) 
			{
	            logger.info(regularConfiguration.getName() + " currently has [" + this.channels.size() + "] open child channel(s) that will be closed as part of stop()");
	        }
			this.channelFactory.shutdown();
			this.channels.close().awaitUninterruptibly();
			this.regularBootstrap.shutdown();
			if(this.securedBootstrap!=null)
			this.securedBootstrap.shutdown();
	        logger.info(regularConfiguration.getName() + " stopped at " + regularConfiguration.getHost());
		}
720242
public void stop() {
    if (acceptChannel == null || !acceptChannel.isOpen()) {
      LOG.info("Fail to stop server; not yet open.");
      return;
    }
    // Clear all connected socket and related stuff
    for (Map.Entry<SocketChannel, SocketChannelHelper> connections : activeConnections.entrySet()) {
      SocketChannel channel = connections.getKey();
      SocketAddress channelAddress = channel.socket().getRemoteSocketAddress();
      LOG.info("Closing connected channel from client: " + channelAddress);
      LOG.info("Removing all interest on channel: " + channelAddress);
      nioLooper.removeAllInterest(channel);

      // Dispatch the child instance
      onClose(channel);
      // Clear the SocketChannelHelper
      connections.getValue().clear();
    }

    // Clear state inside the HeronServer
    activeConnections.clear();
    requestMap.clear();
    messageMap.clear();
    try {
      acceptChannel.close();
    } catch (IOException e) {
      LOG.log(Level.SEVERE, "Failed to close server", e);
    }
  }
306843
final static void stop() {
		if (lifeCycle.getStatus().equals(RunStatus.RUNNING) || lifeCycle.getStatus().equals(RunStatus.DISABLED)) {
			lifeCycle.setStatus(RunStatus.STOPPED);
			Log.info("Preparing to shutdown Audit4j...");

			Log.info("Closing Streams...");
			auditStream.close();

			Log.info("Shutdown handlers...");
			for (Handler handler : configContext.getHandlers()) {
				handler.stop();
				Log.info(handler.getClass().getName() + " shutdown.");
			}

			Log.info("Disposing configurations...");
			configContext = null;
			conf = null;
			Log.info("Audit4j shutdown completed.");
		} else {
			Log.info("No active Audit4j instance. Cancelling shutdown request.");
		}
	}
629590
def shutdown(self):
        
        log.debug('Shutting down %s' % self)
        self.disconnect_all()
        self._looping.clear()
992831
def stop(self):
        
        self._running = False

        if self._socket is None:
            return
        try:
            self._socket.shutdown(socket.SHUT_RDWR)
            self._socket.close()
        except socket.error:
            pass
        self._socket = None