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.
On Thu, Jul 8, 2010 at 3:44 AM, Andriy Kopachevsky
<kopachevsky@gmail.com> wrote:
> Hi, we are trying to set up intergation testing for Cassanrda, so we need to
> run and stop it as embeded service. Don't have any problem to start
> cassandra:
>
> import
> org.apache.cassandra.contrib.utils.service.CassandraServiceDataCleaner;
>
> class SomeTestClass {
>
> @Before
> public void setup() throws TTransportException, IOException,
> InterruptedException {
>
>
> // make a tmp dir and copy storag-conf.xml and log4j.properties to
> it
> copy("/storage-conf.xml", TMP);
> copy("/log4j.properties", TMP);
> System.setProperty("storage-config", TMP);
>
> cassandra = new EmbeddedCassandraService();
> cassandra.init();
> t = new Thread(cassandra);
> t.setDaemon(true);
> t.start();
> }
> }
>
> But this is real problem to stop it, even if you execute t.stop() all other
> threads started up internally still alive. Is there are any way to force
> cassandra to stop? Maybe invoke some internal cassandra api function or
> anything. Thanks.
> Andrey.
>
--
Jonathan Ellis
Project Chair, Apache Cassandra
co-founder of Riptano, the source for professional Cassandra support
http://riptano.com
|