Closes all WS connections on shutdown.
774451
async def on_shutdown(app):
    """"""
    global is_shutting_down
    is_shutting_down = True
    for task in app["websockets"]:
        task.cancel()
        try:
            await task
        except asyncio.CancelledError:
            pass
1233781
public synchronized void close() throws IOException {
        if(getStatus().equals(ConnectionStatus.CLOSED)){
            return ;
        }
        if (LOGGER.isDebugEnabled()) {
            LOGGER.debug("Closing client for session: 0x"
                      + getSessionId());
        }
        connectRun.set(false);

        try{
            clientSocket.cleanup();
        }catch(Exception e){
            LOGGER.warn("Close the WSDirectorySocket get error.", e);
        }

        try {
            setStatus(ConnectionStatus.CLOSED);
            sendCloseSession();
            closeSession();
            eventThread.queueEventOfDeath();
        } catch (ServiceException e) {
            LOGGER.warn("Execute the CloseSession Protocol failed when close", e);
        }
    }
363129
def on_close(self):
        
        self._stop_update_flag = True
        for ws in self.websockets:
            ws.close()
7935
private void discardIdleConnections() {
        List<Connection<CL>> connections = Lists.newArrayList();
        availableConnections.drainTo(connections);
        activeCount.addAndGet(-connections.size());

        for (Connection<CL> connection : connections) {
            try {
                closedConnections.incrementAndGet();
                connection.close(); // This is usually an async operation
            }
            catch (Throwable t) {
                // TODO
            }
        }
    }
721592
def shutdown(self):
        

        # Remove ourself from the dictionary of running managers
        try:
            del self._running_managers[self._manager_key]
        except KeyError:
            pass

        # Kill the listening thread
        self._listen_thread.kill()

        # Close all the connections
        for conn in self.tendrils.values():
            conn.close()

        # Ensure all data is appropriately reset
        self.tendrils = {}
        self.running = False
        self._local_addr = None
        self._local_addr_event.clear()
        self._listen_thread = None
639481
def _shutdown(self):
        
        for exit_handler in self._exit_handlers:
            exit_handler()

        if self._socket:
            self._socket.close()
            self._socket = None
647413
def close(self):
        """"""
        self._condition.acquire()
        try:
            while self._idle_cache: # close all idle connections
                con = self._idle_cache.pop(0)
                try:
                    con._close()
                except Exception:
                    pass
                self._connections -=1
            self._condition.notifyAll()
        finally:
            self._condition.release()
552911
public void close() {
        LOG.info("Begin to shutdown NettyServer");
        if (allChannels != null) {
            new Thread(new Runnable() {

                @Override
                public void run() {
                    try {
                        // await(5, TimeUnit.SECONDS)
                        // sometimes allChannels.close() will block the exit thread
                        allChannels.close().await(1, TimeUnit.SECONDS);
                        LOG.info("Successfully close all channel");
                        factory.releaseExternalResources();
                    } catch (Exception ignored) {
                    }
                    allChannels = null;
                }
            }).start();

            JStormUtils.sleepMs(1000);
        }
        LOG.info("Successfully shutdown NettyServer");
    }
534787
public void shutdown() {
		singleton = null;
		log.info("Shuting down GossipMonger");
		isShutdown.set(true);
		threadPool.shutdown(); // Disable new tasks from being submitted
		// TODO: Wait for messages to end processing
		shutdownAndAwaitTermination(threadPool);
		// Clean ThreadLocal
		ref.remove();
	}
440319
private synchronized void doShutdown() {
      active = false;

      getLogger().debug("{} doShutdown called", getName());

      // close the server socket
      closeServerSocket();

      // close all of the accepted sockets
      closeAllAcceptedSockets();

      if (advertiseViaMulticastDNS) {
          zeroConf.unadvertise();
      }
    }
375593
def exit(self):
        """"""
        # To ensure all connections are properly closed
        self.session.shutdown()
        self.cluster.shutdown()
        # Call the father method
        super(Export, self).exit()
192602
def close_connection(self):
        """"""
        self._logger.info('Closing connection')
        self._closing = True
        self._connection.close()
1239878
public void shutdownNow() {
        allChannels.close();
        workerGroup.shutdownGracefully();
        bossGroup.shutdownGracefully();
        clientGroup.shutdownGracefully();
        if (pipeliningGroup != null) {
            pipeliningGroup.shutdownGracefully();
        }
    }
1334094
public void shutdown() {
        debugConnection = null;
        shuttingDown = true;
        try {
            if (serverSocket != null) {
                serverSocket.close();
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
723346
def close_all_connections
      if @connections.empty?
        EM.stop_event_loop
      else
        server, connection = @connections.shift
        logger.debug "Beetle: closing connection to #{server}"
        connection.close { close_all_connections }
      end
    end
944003
def shutdown(self):
        
        with self._lock:
            for cid in list(self.connections.keys()):
                if self.connections[cid].executing:
                    raise ConnectionBusyError(cid)
                if self.connections[cid].locked:
                    self.connections[cid].free()
                self.connections[cid].close()
                del self.connections[cid]
385114
public void shutDown() {
        synchronized (channels) {
            isCurrentlyShutingDown = true;
            for (final SynchronizeFXWebsocketChannel server : channels.values()) {
                server.shutdown();
            }
            servers.clear();
            channels.clear();
            clients.clear();
            isCurrentlyShutingDown = false;
        }
    }