Jonathan Ellis <jbel...@gmail.com> writes: > there's some support for this in 0.7 (see > http://issues.apache.org/jira/browse/CASSANDRA-1018) but fundamentally > it's not really designed to be started and stopped multiple times > within the same process.
I am currently struggling with some of the same issues (on 0.6.3). I think there are very valid reasons for being able to start and stop Cassandra within the same JVM. in particular for various testing-related scenarios, but also when one wants to experiment with embedding Cassandra. (Having a single-node, embedded Cassandra can be great for testing Cassandra-based applications without forcing "casual users" to go through the ordeal of installing Cassandra). Right now I have an ungodly mess that attempts to embed Cassandra by wrapping the CassandraDaemon, generating a directory hierarchy for it and populating the storage-conf.xml by way of a templating system and then fires up Cassandra. It *sort of* works, except that I haven't found a way to shut Cassandra down reliably. the stop() method doesn't really do anything useful in this respect. (I'd prefer some way of being able to ask it to shut down and then have some way of blocking until it is down). I think some of the errors I am seeing (NPE at at org.apache.cassandra.db.commitlog.CommitLog.recover(CommitLog.java:166)) are probably due to some race condition because of this, but I am guessing here. I'll have another stare at the source. -Bjørn