@Override public HClient borrowClient() throws HectorException { if ( !active.get() ) { throw new HInactivePoolException("Attempt to borrow on in-active pool: " + getName());
@Override public HClient borrowClient() throws HectorException { if ( !active.get() ) { throw new HInactivePoolException("Attempt to borrow on in-active pool: " + getName()); } HClient cassandraClient = availableClientQueue.poll(); int currentActiveClients = activeClientsCount.incrementAndGet(); try { if ( cassandraClient == null ) { if (currentActiveClients <= cassandraHost.getMaxActive()) { cassandraClient = createClient(); } else { // We can't grow so let's wait for a connection to become available. cassandraClient = waitForConnection(); } } if ( cassandraClient == null ) { throw new HectorException("HConnectionManager returned a null client after aquisition - are we shutting down?"); } } catch (RuntimeException e) { activeClientsCount.decrementAndGet(); throw e; } realActiveClientsCount.incrementAndGet(); return cassandraClient; }
@Override public HClient borrowClient() throws HectorException { if ( !active.get() ) { throw new HInactivePoolException("Attempt to borrow on in-active pool: " + getName());