int maxTotalConnections = config.getInt(
GraphDatabaseConfiguration.CONNECTION_POOL_SIZE_KEY,
GraphDatabaseConfiguration.CONNECTION_POOL_SIZE_DEFAULT);
CTConnectionFactory factory = new CTConnectionFactory(hostnames, port, username, password, thriftTimeoutMS, thriftFrameSize);
CTConnectionPool p = new CTConnectionPool(factory);
p.setTestOnBorrow(true);
p.setTestOnReturn(true);
p.setTestWhileIdle(false);
p.setWhenExhaustedAction(GenericKeyedObjectPool.WHEN_EXHAUSTED_BLOCK);
p.setMaxActive(-1); // "A negative value indicates no limit"
p.setMaxTotal(maxTotalConnections); // maxTotal limits active + idle
p.setMinIdle(0); // prevent evictor from eagerly creating unused connections
p.setMinEvictableIdleTimeMillis(60 * 1000L);
p.setTimeBetweenEvictionRunsMillis(30 * 1000L);
this.pool = p;
this.openStores = new HashMap<String, CassandraThriftKeyColumnValueStore>();
}