Hi,
I've got the following working. However, it seems clean and orderly
shutdown is not possible even after calling 'shutdownCluster'. I can
see from my console 'Should exit!?!?!?', there must be some thread
still hanging out there: maybe stuck in an infinite loop or 'wait' not
being interrupted ...
## -- SOURCE CODE: BEGIN --##
public class Main {
/**
* @param args
*/
public static void main(String[] args) {
CassandraHostConfigurator cassandraHostConfigurator = new
CassandraHostConfigurator("
192.168.65.254:9160");
cassandraHostConfigurator.setMaxActive(20);
cassandraHostConfigurator.setMaxIdle(5);
cassandraHostConfigurator.setCassandraThriftSocketTimeout(3000);
cassandraHostConfigurator.setMaxWaitTimeWhenExhausted(4000);
ThriftCluster cluster = new ThriftCluster("Cluster1",
cassandraHostConfigurator);
Keyspace keyspace = HFactory.createKeyspace("Twissandra", cluster);
Serializer<String> stringSerializer = StringSerializer.get();
Mutator<String> mutator = HFactory.createMutator(keyspace,
stringSerializer);
mutator.insert("cassandra", "User",
HFactory.createStringColumn("first", "Cassandra"));
HFactory.shutdownCluster(cluster);
System.out.println("Should exit!?!?!?");
}
}
##-- SOURCE CODE: END --#