protected void init(String clustername, String hosts, String username, String password, String keyspace) {
CassandraHostConfigurator hostconfig = new CassandraHostConfigurator(hosts);
hostconfig.setRetryDownedHosts(true);
hostconfig.setRetryDownedHostsDelayInSeconds(5);
hostconfig.setRetryDownedHostsQueueSize(-1);
this.cluster = HFactory.getOrCreateCluster(clustername, hostconfig);
Map<String,String> credentials = new HashMap<String, String>();
if (username != null && username.length() > 0) {
credentials.put("username", username);
credentials.put("password", password);
}
this.keyspace = HFactory.createKeyspace(
keyspace,
cluster,
new AllOneConsistencyLevelPolicy(),
FailoverPolicy.ON_FAIL_TRY_ALL_AVAILABLE);
}