protected void createBestCassandraConfig(Map<String, Object> properties,
String clusterName, String keyspace2, String seeds2) {
Builder builder = new AstyanaxContext.Builder()
.forCluster(clusterName)
.forKeyspace(keyspace2)
.withAstyanaxConfiguration(new AstyanaxConfigurationImpl()
.setDiscoveryType(NodeDiscoveryType.RING_DESCRIBE)
.setConnectionPoolType(ConnectionPoolType.TOKEN_AWARE)
.setClock(new MicrosecondsAsyncClock())
)
.withConnectionPoolConfiguration(new ConnectionPoolConfigurationImpl("MyConnectionPool")
.setMaxConnsPerHost(20)
.setInitConnsPerHost(2)
.setSeeds(seeds2)
.setConnectTimeout(10000)
.setRetryBackoffStrategy(new FixedRetryBackoffStrategy(5000, 30000))
)
.withConnectionPoolMonitor(new CountingConnectionPoolMonitor());
if(seeds2.contains(",")) {
//for a multi-node cluster, we want the test suite using quorum on writes and
//reads so we have no issues...
AstyanaxConfigurationImpl config = new AstyanaxConfigurationImpl();
config.setDefaultWriteConsistencyLevel(ConsistencyLevel.CL_QUORUM);
config.setDefaultReadConsistencyLevel(ConsistencyLevel.CL_QUORUM);
builder = builder.withAstyanaxConfiguration(config);
}
properties.put(Bootstrap.CASSANDRA_BUILDER, builder);
}