private boolean shutdown(long timeout, TimeUnit unit) throws InterruptedException { if (!isShutdown.compareAndSet(false, true)) return true; long start = System.nanoTime(); boolean success = true; for (HostConnectionPool pool : pools.values()) success &= pool.shutdown(timeout - Cluster.timeSince(start, unit), unit); return success; }
private void shutdown() { if (!isShutdown.compareAndSet(false, true)) return; for (HostConnectionPool pool : pools.values()) pool.shutdown(); }