Removes the given connection manager from this reaper,
and shutting down the reaper if there is zero connection manager left.

@return true if the connection manager has been successfully removed;
false otherwise.
774544
public static boolean removeConnectionManager(HttpClientConnectionManager connectionManager) {
        boolean wasRemoved = connectionManagers.remove(connectionManager) != null;
        if (connectionManagers.isEmpty()) {
            shutdown();
        }
        return wasRemoved;
    }
758122
@Override
    public void destroy()
    {
        indexManager.close();
        if (schemaManager != null)
        {
            schemaManager.dropSchema();
        }
        if (mongoDB != null)
        {
            logger.info("Closing connection to mongodb.");
            mongoDB.getMongo().close();
            logger.info("Closed connection to mongodb.");
        }
        else
        {
            logger.warn("Can't close connection to MONGODB, it was already disconnected");
        }
        externalProperties = null;
        schemaManager = null;
    }
1202220
public boolean remove() {
		try {
			if(!isBinary)return getJedisCommands(groupName).del(key) == 1;
			if(isCluster(groupName)){
				return getBinaryJedisClusterCommands(groupName).del(keyBytes) == 1;
			}
			return getBinaryJedisCommands(groupName).del(keyBytes) == 1;
		} finally {
			getJedisProvider(groupName).release();
		}
	}
892626
protected ConnectionListener removeConnectionListener(boolean free, Collection<ConnectionListener> listeners)
   {
      if (free)
      {
         for (ConnectionListener cl : listeners)
         {
            if (cl.changeState(FREE, IN_USE))
               return cl;
         }
      }
      else
      {
         for (ConnectionListener cl : listeners)
         {
            if (cl.getState() == IN_USE)
               return cl;
         }
      }

      return null;
   }
736460
public boolean remove() {
		if (exists() && !isRemoved()) {
			isRemoved = true;
			node.getParent().removeChild(nodeFqn.getLastElement());
			if (doTraceLogs) {
				logger.trace("removed cache node "+nodeFqn);
			}	
			return true;
		}
		else {
			return false;
		}
	}
167922
@Override
    public void destroy()
    {
        // if(logger.isDebugEnabled())
        logger.info("on close destroying connection pool");

        if (getConnectionPoolOrConnection() != null && getConnectionPoolOrConnection() instanceof JedisPool)
        {
            ((JedisPool) getConnectionPoolOrConnection()).destroy();
        }
        else if (getConnectionPoolOrConnection() != null && getConnectionPoolOrConnection() instanceof Jedis)
        {
            ((Jedis) getConnectionPoolOrConnection()).disconnect();
        }

    }
1241114
boolean _close()
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "_close");

    boolean closedNow = false;

    synchronized (this)
    {
      if (!_closed)
      {
        _closed = true;
        closedNow = true;
      }
    }

    if (closedNow)
    {
      /*
       * This must be done outside the synchronization as it will synchronize on
       * the set of producer sessions whilst detaching this producer and if not
       * done outside, this could cause a deadlock with methods that synchronize
       * on the set and then each producersession in the set in turn.
       */
      _inputHandler.detachProducer(this);
      _inputHandler = null;
    }

    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "_close", new Boolean(closedNow));

    return closedNow;
  }
606670
public boolean removeHandler(PacketHandler handler) {
        synchronized (this.handlers) {
            boolean removed = this.handlers.remove(handler);
            if (removed) {
                this.count.decrementAndGet();
            }
            return removed;
        }
    }
794383
public boolean shutdown() {
    mServer.shutdown();
    try {
      return mServer.awaitTermination(mServerShutdownTimeoutMs, TimeUnit.MILLISECONDS);
    } catch (InterruptedException ie) {
      Thread.currentThread().interrupt();
      return false;
    } finally {
      mServer.shutdownNow();
    }
  }
60042
@Override
    public void shutdown()
    {
        if (manager != null)
        {
            manager.removalAll();
            manager = null;
        }
        cache = null;
    }
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();
    }
  }
1221320
function () {
    if (!self.connections.length) {
      self.removeListener('remove', remove);
      self.closing = false;
      return callback();
    }
  }
1347739
def close(self):
        

        if not (yield from super().close()):
            return False

        self.acpi_shutdown = False
        yield from self.stop()

        for adapter in self._ethernet_adapters:
            if adapter is not None:
                for nio in adapter.ports.values():
                    if nio and isinstance(nio, NIOUDP):
                        self.manager.port_manager.release_udp_port(nio.lport, self._project)

        for udp_tunnel in self._local_udp_tunnels.values():
            self.manager.port_manager.release_udp_port(udp_tunnel[0].lport, self._project)
            self.manager.port_manager.release_udp_port(udp_tunnel[1].lport, self._project)
        self._local_udp_tunnels = {}
1010462
def close(self):
        

        if not (yield from super().close()):
            return False

        adapters = self._ethernet_adapters + self._serial_adapters
        for adapter in adapters:
            if adapter is not None:
                for nio in adapter.ports.values():
                    if nio and isinstance(nio, NIOUDP):
                        self.manager.port_manager.release_udp_port(nio.lport, self._project)

        yield from self.stop()
1095712
public synchronized void shutdown(){

		if (!this.poolShuttingDown){
			logger.info("Shutting down connection pool...");
			this.poolShuttingDown = true;
			this.shutdownStackTrace = captureStackTrace(SHUTDOWN_LOCATION_TRACE);
			this.keepAliveScheduler.shutdownNow(); // stop threads from firing.
			this.maxAliveScheduler.shutdownNow(); // stop threads from firing.
			this.connectionsScheduler.shutdownNow(); // stop threads from firing.
			this.asyncExecutor.shutdownNow();

			try {
				this.connectionsScheduler.awaitTermination(5, TimeUnit.SECONDS);

				this.maxAliveScheduler.awaitTermination(5, TimeUnit.SECONDS);
				this.keepAliveScheduler.awaitTermination(5, TimeUnit.SECONDS);
				this.asyncExecutor.awaitTermination(5, TimeUnit.SECONDS);
				
				if (this.closeConnectionExecutor != null){
					this.closeConnectionExecutor.shutdownNow();
					this.closeConnectionExecutor.awaitTermination(5, TimeUnit.SECONDS);
				}
				
			} catch (InterruptedException e) {
				// do nothing
			}
			this.connectionStrategy.terminateAllConnections();
			unregisterDriver();
			registerUnregisterJMX(false);
			if (finalizableRefQueue != null) {
				finalizableRefQueue.close();
			}
			    logger.info("Connection pool has been shutdown.");
		}
	}
90330
@Override
    public void destroy()
    {
        close();

        URLConnection conn = _conn;
        _conn = null;

        if (conn instanceof HttpURLConnection)
            ((HttpURLConnection) conn).disconnect();
    }
276697
public CompletableFuture<Void> kill() {
    return submitter.close()
      .thenCompose(v -> listener.close())
      .thenCompose(v -> manager.kill())
      .thenCompose(v -> connection.close());
  }