Updated Branches:
  refs/heads/trunk 486f0792d -> 49c5ed271

add StorageService.stopDaemon
patch by Lyuben Todorov; reviewed by Tyler Hobbs for CASSANDRA-4268


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/142e13f3
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/142e13f3
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/142e13f3

Branch: refs/heads/trunk
Commit: 142e13f34031167cae61991de468613d905eb76f
Parents: 7bf1464
Author: Jonathan Ellis <jbel...@apache.org>
Authored: Fri Dec 20 15:23:36 2013 -0600
Committer: Jonathan Ellis <jbel...@apache.org>
Committed: Fri Dec 20 15:23:36 2013 -0600

----------------------------------------------------------------------
 CHANGES.txt                                                 | 1 +
 src/java/org/apache/cassandra/service/StorageService.java   | 9 +++++++++
 .../org/apache/cassandra/service/StorageServiceMBean.java   | 3 +++
 src/java/org/apache/cassandra/tools/NodeCmd.java            | 7 +++++++
 src/java/org/apache/cassandra/tools/NodeProbe.java          | 5 +++++
 5 files changed, 25 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/142e13f3/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 67036c5..916ed7d 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 2.0.4
+ * add StorageService.stopDaemon() (CASSANDRA-4268)
  * add IRE for invalid CF supplied to get_count (CASSANDRA-5701)
  * add client encryption support to sstableloader (CASSANDRA-6378)
  * Fix accept() loop for SSL sockets post-shutdown (CASSANDRA-6468)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/142e13f3/src/java/org/apache/cassandra/service/StorageService.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/service/StorageService.java 
b/src/java/org/apache/cassandra/service/StorageService.java
index c341684..cca7b00 100644
--- a/src/java/org/apache/cassandra/service/StorageService.java
+++ b/src/java/org/apache/cassandra/service/StorageService.java
@@ -380,6 +380,15 @@ public class StorageService extends 
NotificationBroadcasterSupport implements IE
         return initialized;
     }
 
+    public void stopDaemon()
+    {
+        if (daemon == null)
+            throw new IllegalStateException("No configured daemon");
+        daemon.deactivate();
+        // completely shut down cassandra
+        System.exit(0);
+    }
+
     public synchronized Collection<Token> prepareReplacementInfo() throws 
ConfigurationException
     {
         logger.info("Gathering node replacement information for {}", 
DatabaseDescriptor.getReplaceAddress());

http://git-wip-us.apache.org/repos/asf/cassandra/blob/142e13f3/src/java/org/apache/cassandra/service/StorageServiceMBean.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/service/StorageServiceMBean.java 
b/src/java/org/apache/cassandra/service/StorageServiceMBean.java
index be1b0aa..df85901 100644
--- a/src/java/org/apache/cassandra/service/StorageServiceMBean.java
+++ b/src/java/org/apache/cassandra/service/StorageServiceMBean.java
@@ -395,6 +395,9 @@ public interface StorageServiceMBean extends 
NotificationEmitter
     // allows a user to recover a forcibly 'killed' node
     public void startGossiping();
 
+    // allows a user to forcibly completely stop cassandra
+    public void stopDaemon();
+
     // to determine if gossip is disabled
     public boolean isInitialized();
 

http://git-wip-us.apache.org/repos/asf/cassandra/blob/142e13f3/src/java/org/apache/cassandra/tools/NodeCmd.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/tools/NodeCmd.java 
b/src/java/org/apache/cassandra/tools/NodeCmd.java
index 5c071b6..c32539f 100644
--- a/src/java/org/apache/cassandra/tools/NodeCmd.java
+++ b/src/java/org/apache/cassandra/tools/NodeCmd.java
@@ -162,6 +162,7 @@ public class NodeCmd
         STATUSBINARY,
         STATUSTHRIFT,
         STOP,
+        STOPDAEMON,
         TPSTATS,
         UPGRADESSTABLES,
         VERSION,
@@ -1288,6 +1289,12 @@ public class NodeCmd
                     probe.stop(arguments[0].toUpperCase());
                     break;
 
+                case STOPDAEMON:
+                    if (arguments.length != 0) { badUse("stopdaemon does not 
take arguments."); }
+                    try { probe.stopCassandraDaemon(); }
+                    catch (Throwable t) { System.out.println("Cassandra has 
shut down.\n"); }
+                    break;
+
                 case DESCRIBERING :
                     if (arguments.length != 1) { badUse("Missing keyspace 
argument for describering."); }
                     nodeCmd.printDescribeRing(arguments[0], System.out);

http://git-wip-us.apache.org/repos/asf/cassandra/blob/142e13f3/src/java/org/apache/cassandra/tools/NodeProbe.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/tools/NodeProbe.java 
b/src/java/org/apache/cassandra/tools/NodeProbe.java
index d784f29..4f60464 100644
--- a/src/java/org/apache/cassandra/tools/NodeProbe.java
+++ b/src/java/org/apache/cassandra/tools/NodeProbe.java
@@ -766,6 +766,11 @@ public class NodeProbe
         return ssProxy.isRPCServerRunning();
     }
 
+    public void stopCassandraDaemon()
+    {
+        ssProxy.stopDaemon();
+    }
+
     public boolean isInitialized()
     {
         return ssProxy.isInitialized();

Reply via email to