Permalink
Browse files

added limit on how long client pool can be exhausted

  • Loading branch information...
2 parents 04673ff + e738a85 commit c0efcabd902a2f9d93a3f2bb22a8ffa7b770af55 @shaunkalley shaunkalley committed Sep 6, 2013
Showing with 8 additions and 2 deletions.
  1. +8 −2 core/src/main/java/me/prettyprint/cassandra/connection/HConnectionManager.java
@@ -272,8 +272,14 @@ public void operateWithFailover(Operation<?> op) throws HectorException {
// TODO timecheck on how long we've been waiting on timeouts here
// suggestion per user moores on hector-users
} else if (he instanceof HPoolExhaustedException) {
- if (pool.getExhaustedTime() >= pool.getCassandraHost().getMaxExhaustedTimeBeforeSuspending()) {
- suspendCassandraHost(pool.getCassandraHost());
+ CassandraHost host = pool.getCassandraHost();
+ long exhaustedTime = pool.getExhaustedTime();
+ if (exhaustedTime >= host.getMaxExhaustedTimeBeforeSuspending()) {
+ if (suspendCassandraHost(host)) {
+ log.warn("Client pool for {} was exhausted for {} ms and was suspended", host, exhaustedTime);
+ } else {
+ log.warn("Client pool for {} was exhausted for {} ms but could not be suspended", host, exhaustedTime);
+ }
if (hostPools.isEmpty()) {
throw he;
}

0 comments on commit c0efcab

Please sign in to comment.