Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add stopServer method to CassandraUtils.java. This is useful in scena…

…rios where the client code must guarantee a clean exit of Cassandra, such as in test suites.
  • Loading branch information...
commit dfb7507a27761f7e409243ea3bc7f79c941b61bd 1 parent b8d8b81
Chris Nauroth cnauroth authored
Showing with 13 additions and 1 deletion.
  1. +13 −1 src/lucandra/CassandraUtils.java
14 src/lucandra/CassandraUtils.java
View
@@ -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)
Please sign in to comment.
Something went wrong with that request. Please try again.