}
@Override
protected void createBestCassandraConfig(Map<String, Object> properties,
String clusterName, String keyspace2, String seeds2) {
ConnectionPoolConfigurationImpl poolConfig = new ConnectionPoolConfigurationImpl("MyConnectionPool")
.setMaxConnsPerHost(20)
.setInitConnsPerHost(2)
.setSeeds(seeds2)
.setConnectTimeout(10000)
.setRetryBackoffStrategy(new FixedRetryBackoffStrategy(5000, 30000));
Object username = properties.get(Bootstrap.CASSANDRA_USERNAME);
Object password = properties.get(Bootstrap.CASSANDRA_PASSWORD);
if (username != null && password != null) {
poolConfig.setAuthenticationCredentials(new SimpleAuthenticationCredentials(""+username, ""+password));
}
Object port = properties.get(Bootstrap.CASSANDRA_THRIFT_PORT);
if(port != null) {
int portVal = 9160;
if(port instanceof Integer)
portVal = (Integer) port;
else if(port instanceof String)
portVal = Integer.valueOf((String) port);
else
throw new RuntimeException(Bootstrap.CASSANDRA_THRIFT_PORT+" key in map has a value of type="+port.getClass()+" but that must be a String or Integer");
poolConfig.setPort(portVal);
}
Builder builder = new AstyanaxContext.Builder()
.forCluster(clusterName)
.forKeyspace(keyspace2)