Shuts down this channel pool and releases all retained resources.

@return a {@code Future} that will be completed when all resources held by this pool have been released
343654
public Future<Void> close() {
        return this.allChannels.close().addListener(new GenericFutureListener<Future<Void>>() {
            @Override
            public void operationComplete(final Future<Void> future) throws Exception {
                ApnsChannelPool.this.isClosed = true;

                if (ApnsChannelPool.this.channelFactory instanceof Closeable) {
                    ((Closeable) ApnsChannelPool.this.channelFactory).close();
                }

                for (final Promise<Channel> acquisitionPromise : ApnsChannelPool.this.pendingAcquisitionPromises) {
                    acquisitionPromise.tryFailure(POOL_CLOSED_EXCEPTION);
                }
            }
        });
    }
1357942
public Future<Channel> renegotiate() {
        ChannelHandlerContext ctx = this.ctx;
        if (ctx == null) {
            throw new IllegalStateException();
        }

        return renegotiate(ctx.executor().<Channel>newPromise());
    }
204342
static void shutdown() {
        synchronized (lock) {
            switch (state) {
            case RUNNING:       /* Initiate shutdown */
                state = HOOKS;
                break;
            case HOOKS:         /* Stall and then return */
            case FINALIZERS:
                break;
            }
        }
        synchronized (Shutdown.class) {
            sequence();
        }
    }
192266
public void shutdown() {
		synchronized (globalLock) {
			for (Instance i : allInstances) {
				i.removeSlotListener();
				i.cancelAndReleaseAllSlots();
			}
			allInstances.clear();
			allInstancesByHost.clear();
			instancesWithAvailableResources.clear();
			taskQueue.clear();
		}
	}
77735
@Override
  public void close() throws IOException {
    try {
      mLock.lock();
      if (mAvailableResources.size() != mResources.size()) {
        LOG.warn("{} resources are not released when closing the resource pool.",
            mResources.size() - mAvailableResources.size());
      }
      for (ResourceInternal<T> resourceInternal : mAvailableResources) {
        closeResource(resourceInternal.mResource);
      }
      mAvailableResources.clear();
    } finally {
      mLock.unlock();
    }
    mGcFuture.cancel(true);
  }
629952
protected Object shutdown() throws IOException {
	logger.debug("shutdown");

	// close the socket
	writer.close();

	// garbage collect the socket
	socketBox.setSocket(null);

	// attempt to obtain permission to close data source
	Object quitToken = context.getQuitToken();

	// data source is shared by all data channels,
	// so should be closed by the last one exiting
	if (quitToken != null) {
	    source.close();
	}

	return quitToken;
    }
422449
public synchronized boolean shutdown() {
        if (channel == null) {
            return false;
        }
        Address address = channel.getAddress();
        LOGGER.debug("{0} shutting down clustering service...", address);
        consumers.clear();

        // Mark this as not accepting any more ...
        isOpen.set(false);
        
        try {
            // Disconnect from the channel and close it ...
            channel.disconnect();
            channel.removeChannelListener(listener);
            channel.setReceiver(null);
            channel.close();
            LOGGER.debug("{0} successfully closed main channel", address);
        } finally {
            channel = null;
        }
        membersInCluster.set(1);
        return true;
    }
882920
@Override
  public void close() {
    executor.shutdown();
    scheduler.shutdown();
    client.close();
    closeFuture.complete(null);
  }
970150
@Override
  public ManagedChannelImpl shutdown() {
    channelLogger.log(ChannelLogLevel.DEBUG, "shutdown() called");
    if (!shutdown.compareAndSet(false, true)) {
      return this;
    }

    // Put gotoState(SHUTDOWN) as early into the syncContext's queue as possible.
    // delayedTransport.shutdown() may also add some tasks into the queue. But some things inside
    // delayedTransport.shutdown() like setting delayedTransport.shutdown = true are not run in the
    // syncContext's queue and should not be blocked, so we do not drain() immediately here.
    final class Shutdown implements Runnable {
      @Override
      public void run() {
        channelLogger.log(ChannelLogLevel.INFO, "Entering SHUTDOWN state");
        channelStateManager.gotoState(SHUTDOWN);
      }
    }

    syncContext.executeLater(new Shutdown());

    uncommittedRetriableStreamsRegistry.onShutdown(SHUTDOWN_STATUS);
    final class CancelIdleTimer implements Runnable {
      @Override
      public void run() {
        cancelIdleTimer(/* permanent= */ true);
      }
    }

    syncContext.execute(new CancelIdleTimer());
    return this;
  }
1085431
private void shutdownBatchPool() {
    if (this.cleanupPool && this.batchPool != null && !this.batchPool.isShutdown()) {
      this.batchPool.shutdown();
      try {
        if (!this.batchPool.awaitTermination(10, TimeUnit.SECONDS)) {
          this.batchPool.shutdownNow();
        }
      } catch (InterruptedException e) {
        Thread.currentThread().interrupt();
        this.batchPool.shutdownNow();
      }
    }
  }
1279987
public CompletableFuture<Void> expire() {
    CompletableFuture<Void> future = new CompletableFuture<>();
    context.executor().execute(() -> {
      if (keepAlive != null)
        keepAlive.cancel();
      state.setState(Session.State.EXPIRED);
      future.complete(null);
    });
    return future;
  }
419683
@Override
    public void close() {
        if (!this.closed.getAndSet(true)) {
            if (state() == State.RUNNING) {
                Futures.await(Services.stopAsync(this, this.executorService));
            }

            synchronized (this.clients) {
                this.clients.clear();
            }

            this.metrics.close();
            log.info("{} Closed.", TRACE_OBJECT_ID);
        }
    }
1004485
Future<Boolean> shutdown() {
        // Create a simple executor that will do the backgrounding for us ...
        final ExecutorService executor = Executors.newSingleThreadExecutor(new NamedThreadFactory("modeshape-repository-stop"));
        try {
            // Submit a runnable to terminate all sessions ...
            return executor.submit(() -> doShutdown(false));
        } finally {
            // Now shutdown the executor and return the future ...
            executor.shutdown();
        }
    }
876761
public void stop() {
        if (future != null) {
            future.cancel(true);
        }
        if (executor != null) {
            executor.shutdownNow();
        }
    }
1010625
public void releaseAllResources()
    {
        super.releaseAllResources();
        synchronized (poolSynch)
        {
            if (!poolMap.isEmpty())
            {
                Collection pools = poolMap.values();
                Iterator iterator = pools.iterator();
                ObjectPool op = null;
                while (iterator.hasNext())
                {
                    try
                    {
                        op = (ObjectPool) iterator.next();
                        op.close();
                    }
                    catch (Exception e)
                    {
                        log.error("Exception occured while closing ObjectPool " + op, e);
                    }
                }
                poolMap.clear();
            }
            dsMap.clear();
        }
    }
331310
@Override
    public final void close() {
        final CompletableFuture<Void> f;
        synchronized (this) {
            if (state == State.STOPPED) {
                return;
            }
            f = stop(null);
        }

        boolean interrupted = false;
        for (;;) {
            try {
                f.get();
                break;
            } catch (InterruptedException ignored) {
                interrupted = true;
            } catch (ExecutionException e) {
                closeFailed(Exceptions.peel(e));
                break;
            }
        }

        if (interrupted) {
            Thread.currentThread().interrupt();
        }
    }
605257
public CompletableFuture<Void> close() {
    if (state.getState() == Session.State.EXPIRED)
      return CompletableFuture.completedFuture(null);

    CompletableFuture<Void> future = new CompletableFuture<>();
    context.executor().execute(() -> {
      if (keepAlive != null) {
        keepAlive.cancel();
        keepAlive = null;
      }
      unregister(future);
    });
    return future;
  }