Skip to content

Add stopServer method to CassandraUtils.java. This is useful in scenario #121

Merged
merged 1 commit into from Aug 17, 2011
View
14 src/lucandra/CassandraUtils.java
@@ -188,6 +188,8 @@
private static boolean cassandraStarted = false;
+ private static CassandraDaemon daemon = null;
+
public static String fakeToken = String.valueOf(System.nanoTime());
public static synchronized void setStartup()
@@ -250,7 +252,7 @@ public static synchronized void startupServer() throws IOException
System.setProperty("cassandra-foreground", "1");
- final CassandraDaemon daemon = new CassandraDaemon();
+ daemon = new CassandraDaemon();
try
{
@@ -284,6 +286,16 @@ public void run()
}
}
+ public static synchronized void stopServer()
+ {
+ if (!cassandraStarted)
+ return;
+
+ daemon.deactivate();
+ daemon = null;
+ cassandraStarted = false;
+ }
+
public static void createCassandraSchema() throws IOException
{
if (!cassandraStarted)
Something went wrong with that request. Please try again.