ConcurrentHClientPool implements HClientPool { @Override public void shutdown() { if (!active.compareAndSet(true, false) ) { throw new IllegalArgumentException("shutdown() called for inactive pool: " + getName()); } log.info("Shutdown triggered on {}", getName()); Set<HClient> clients = new HashSet<HClient>(); availableClientQueue.drainTo(clients); if ( clients.size() > 0 ) { for (HClient hClient : clients) { hClient.close(); } } log.info("Shutdown complete on {}", getName()); } ConcurrentHClientPool(HClientFactory clientFactory, CassandraHost host, CassandraClientMonitor monitor); @Override HClient borrowClient(); @Override void shutdown(); @Override CassandraHost getCassandraHost(); @Override String getName(); @Override int getNumActive(); @Override int getNumBeforeExhausted(); @Override int getNumBlockedThreads(); @Override int getNumIdle(); @Override boolean isExhausted(); @Override int getMaxActive(); @Override boolean getIsActive(); @Override long getExhaustedTime(); @Override String getStatusAsString(); @Override void releaseClient(HClient client);  }
@Test public void testShutdown() { clientPool.shutdown(); assertEquals(0, clientPool.getNumIdle()); assertEquals(0, clientPool.getNumBlockedThreads()); assertEquals(0, clientPool.getNumActive()); try { clientPool.borrowClient(); fail(); } catch (HInactivePoolException e) { } }