org.apache.cassandra.service
Class EmbeddedCassandraService
java.lang.Object
org.apache.cassandra.service.EmbeddedCassandraService
- All Implemented Interfaces:
- java.lang.Runnable
public class EmbeddedCassandraService
- extends java.lang.Object
- implements java.lang.Runnable
An embedded, in-memory cassandra storage service that listens
on the thrift interface as configured in storage-conf.xml
This kind of service is useful when running unit tests of
services using cassandra for example.
See EmbeddedCassandraServiceTest
for usage.
This is the implementation of https://issues.apache.org/jira/browse/CASSANDRA-740
How to use:
In the client code create a new thread and spawn it with its Thread.start()
method.
Example:
// Tell cassandra where the configuration files are.
System.setProperty("storage-config", "conf");
cassandra = new EmbeddedCassandraService();
cassandra.init();
// spawn cassandra in a new thread
Thread t = new Thread(cassandra);
t.setDaemon(true);
t.start();
- Author:
- Ran Tavory (rantav@gmail.com)
Method Summary |
void |
init()
|
void |
run()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
EmbeddedCassandraService
public EmbeddedCassandraService()
init
public void init()
throws org.apache.thrift.transport.TTransportException,
java.io.IOException
- Throws:
org.apache.thrift.transport.TTransportException
java.io.IOException
run
public void run()
- Specified by:
run
in interface java.lang.Runnable
Copyright © 2010 The Apache Software Foundation