close all channels, and release resources
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");
    }
4253
protected function closeChannels()
    {
        foreach ($this->channels as $key => $channel) {
            // channels[0] is this connection object, so don't close it yet
            if ($key === 0) {
                continue;
            }
            try {
                $channel->close();
            } catch (\Exception $e) {
                /* Ignore closing errors */
            }
        }
    }
572812
def shutdown(self):
        """"""
        self.stop_all_periodic_tasks()
        for channel in self._bcm_sockets:
            log.debug("Closing bcm socket for channel {}".format(channel))
            bcm_socket = self._bcm_sockets[channel]
            bcm_socket.close()
        log.debug("Closing raw can socket")
        self.socket.close()
1330918
public static void closeAll() {
    try { H2O._udpSocket.close(); } catch( IOException e ) { }
    try { H2O._apiSocket.close(); } catch( IOException e ) { }
    try { TCPReceiverThread.SOCK.close(); } catch( IOException e ) { }
  }
1200769
def close(self):
        
        self.cell = None
        self.coro = None
        self.buffer = None
        del self.dests[:]
        del self.sources[:]
1123351
def close(self):
        
        if not self._content_consumed:
            self.raw.close()

        release_conn = getattr(self.raw, 'release_conn', None)
        if release_conn is not None:
            release_conn()
464639
def release_all(self, callback: Callable[[str, Any, Any], None]):
        """"""
        self._all_callbacks.remove(callback)
556476
def close(self):
        
        if not self.active:
            return
        self.stop_thread()
        for chan in list(self._channels.values()):
            chan._unlink()
        self.sock.close()
529557
public static void closeQuietly(final Channel channel)
    {
        if (channel != null && channel.isOpen()) {
            try {
                channel.close();
            }
            catch (IOException ioe) {
                LOG.warnDebug(ioe, "While closing session");
            }
        }
    }
1233190
def close(self):
        
        keys = set(self._conns.keys())
        for key in keys:
            self.stop_socket(key)

        self._conns = {}
1095731
public void close() {
    if (socketChannel == null) {
      return;
    }

    monitor.remove(socketChannel);
    try {
      socketChannel.close();
    } catch (IOException ignored) {
      /* nothing to be done */
    } finally {
      socketChannel = null;
    }
  }
977091
def close_all(self):
        """"""
        for host, conns in self._cm.get_all().items():
            for h in conns:
                self._cm.remove(h)
                h.close()
175237
void close() {
        try {
            performTeardownExchange();
        } catch (IOException e) {
            logger.warn("Problem reporting our intention to close the dbserver connection", e);
        }
        try {
            channel.close();
        } catch (IOException e) {
            logger.warn("Problem closing dbserver client output channel", e);
        }
        try {
            os.close();
        } catch (IOException e) {
            logger.warn("Problem closing dbserver client output stream", e);
        }
        try {
            is.close();
        } catch (IOException e) {
            logger.warn("Problem closing dbserver client input stream", e);
        }
        try {
            socket.close();
        } catch (IOException e) {
            logger.warn("Problem closing dbserver client socket", e);
        }
    }
179227
private function close()
    {
        if (null !== $this->pipe && $this->pipe->isOpen()) {
            $this->pipe->close();
        }

        if (is_resource($this->socket)) {
            fclose($this->socket);
        }

        $this->thread = null;
        $this->channel = null;
    }
1031828
def close(self):
        """"""
        try:
            self._socket.sendall('quit\r\n')
        except socket.error:
            pass
        try:
            self._socket.close()
        except socket.error:
            pass
416437
@Override
    public void close() throws IOException
    {
        if (!isClosed)
        {
            flush();
            if (closeChannel)
            {
                channel.close();
            }
            isClosed = true;
        }
    }
605515
public function close()
    {
        foreach ($this->channel_refs as $channel_ref) {
            $channel_ref->getRealChannel($this->credentials)->close();
        }
        $this->is_closed = true;
    }