Permanently dispose of the broker client.

        This terminates any outstanding connection and cancels any pending
        requests.
963866
def close(self):
        
        log.debug('%r: close() proto=%r connector=%r', self, self.proto, self.connector)
        assert self._dDown is None
        self._dDown = Deferred()

        if self.proto is not None:
            self.proto.transport.loseConnection()
        elif self.connector is not None:
            def connectingFailed(reason):
                """
                Handle the failure resulting from cancellation.

                :reason: a `Failure`, most likely a cancellation error (but
                    that's not guaranteed).
                :returns: `None` to handle the failure
                """
                log.debug('%r: connection attempt has been cancelled: %r', self, reason)
                self._dDown.callback(None)

            self.connector.addErrback(connectingFailed)
            self.connector.cancel()
        else:
            # Fake a cleanly closing connection
            self._dDown.callback(None)

        try:
            raise CancelledError(message="Broker client for node_id={} {}:{} was closed".format(
                self.node_id, self.host, self.port))
        except Exception:
            reason = Failure()
        # Cancel any requests
        for correlation_id in list(self.requests.keys()):  # must copy, may del
            self.cancelRequest(correlation_id, reason)
        return self._dDown
951521
protected void finishConnection() {
    this.connector.dispose();
    this.connector = null;
    for (ConnectionListener listener : this.connectionListeners) {
      listener.connectionEnded(this);
    }
    if (this.executors != null) {
      this.executors.destroy();
    }
  }
694538
def _dispose(self):
        """"""
        self.close()
        # _DBProxy.dispose doesn't actually call dispose on the pool
        conn_params = self.get_connection_params()
        key = db_pool._serialize(**conn_params)
        try:
            pool = db_pool.pools[key]
        except KeyError:
            pass
        else:
            pool.dispose()
            del db_pool.pools[key]
1221136
def purge(self):
        
        while not self.stopped.isSet():
            self.stopped.wait(timeout=defines.EXCHANGE_LIFETIME)
            self._messageLayer.purge()
23404
public void shutdown() {
        if (clientList == null) {
            return;
        }
        cancelEvictor();
        for (RedisClient connection : clientList) {
            try {
                connection.shutdown();
            } catch (Exception e) {
                logger.debug(e.getMessage(), e);
            }
        }
    }
1117782
def _cleanup(self):
        '''
        
        '''
        self._ack_listener = None
        self._nack_listener = None
        self._broker_cancel_cb_map = None
        super(RabbitBasicClass, self)._cleanup()
1307212
@FFDCIgnore(value = { InterruptedException.class })
    public void close() {
        // remove all the clients from the deque, closing them as we go
        while (numClientsClosed.get() < numClients) {
            try {
                Client client = clients.takeFirst();
                try {
                    client.close();
                } catch (Exception e) {
                    //Ignore this
                }
                numClientsClosed.incrementAndGet();

                if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled())
                    Tr.event(tc, "pool closed   - " + numClientsClosed + " of " + numClients + " clients closed");
            } catch (InterruptedException e) {
                if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled())
                    Tr.event(tc, "InterruptedException during close - will retry");
            }
        }
    }
797245
void removeClient(ClientSocket client)
    {
        if (client != null)
        {
            toRemove.add(client);
            client.terminate();
            clientsNumber--;
            willRemove = true;
            Verbose.info(SERVER, client.getName(), " disconnected");
        }
    }
1014602
@Override
    public final void destroy()
    {
        synchronized (this.connectionMonitor)
        {
            if (this.connection != null)
            {
                this.connection.destroy();
                this.connection = null;
            }
        }
        reset();
    }
1199078
@Override
	public void terminateAllConnections() {
		this.terminationLock.lock();
		try {
			for (int i = 0; i < this.pool.thriftServerCount; i++) {
				this.pool.partitions.get(i).setUnableToCreateMoreTransactions(false);
				List<ThriftConnectionHandle<T>> clist = new LinkedList<>();
				this.pool.partitions.get(i).getFreeConnections().drainTo(clist);
				for (ThriftConnectionHandle<T> c : clist) {
					this.pool.destroyConnection(c);
				}

			}
		} finally {
			this.terminationLock.unlock();
		}
	}
1227867
public function dispose() {
        parent::dispose(); // Call parent dispose to write/close session and other common stuff before closing connection
        if ($this->oci) {
            oci_close($this->oci);
            $this->oci = null;
        }
    }
375094
def terminate(self):
        """"""
        self._backend_client.clear()
        self._needs_save = False
        self._started = False
        self._expire_cookie = True
        self._send_cookie = True
353443
public void dispose() {
        logDebug("Disposing.");
        mSetupDone = false;
        if (mServiceConn != null) {
            logDebug("Unbinding from service.");
            if (mContext != null) mContext.unbindService(mServiceConn);
        }
        mDisposed = true;
        mContext = null;
        mServiceConn = null;
        mService = null;
        mPurchaseListener = null;
    }
1353716
def close(self):
        
        if self.is_connected:
            self.client.close()
            if self.forward_agent and self._agent_handler is not None:
                self._agent_handler.close()
241351
def close(self):
        
        try:
            super(DockerFabricClient, self).close()
        finally:
            if self._tunnel is not None:
                self._tunnel.close()
1061101
def close(&blk)
      if @closed
        blk.call if blk
      else
        @closed = true
        @connection_status = {}
        handler = CountedDeferrable.new(@brokers.size)
        handler.callback { blk.call if blk }
        @brokers.each do |b|
          begin
            b.close(propagate = false) { handler.completed_one }
          rescue StandardError => e
            handler.completed_one
            logger.exception("Failed to close broker #{b.alias}", e, :trace)
            @exception_stats.track("close", e)
          end
        end
      end
      true
    end
559370
def release_client(self, client):
        
        if isinstance(client, Client):
            if not self._is_expired_client(client):
                LOG.debug('Client is not expired. Adding back to pool')
                self.__pool.append(client)
            elif client.is_connected():
                LOG.debug('Client is expired and connected. Disconnecting')
                client.disconnect()
        if self.__sem is not None:
            self.__sem.release()