nodetool stopdaemon errors out

patch by Robert Stupp; reviewed by Alex Petrov for CASSANDRA-12646


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

Branch: refs/heads/trunk
Commit: 6c6407411f4955967297331798e9d0c57644b311
Parents: 7a274dd
Author: Robert Stupp <sn...@snazy.de>
Authored: Thu Oct 13 15:18:56 2016 +0200
Committer: Robert Stupp <sn...@snazy-ds15.fritz.box>
Committed: Thu Oct 13 15:18:56 2016 +0200

----------------------------------------------------------------------
 CHANGES.txt                                            |  1 +
 src/java/org/apache/cassandra/tools/NodeProbe.java     | 13 +++++++++++--
 .../apache/cassandra/tools/nodetool/StopDaemon.java    |  3 +--
 3 files changed, 13 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/6c640741/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index dc7bcab..a962994 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 3.0.10
+ * nodetool stopdaemon errors out (CASSANDRA-12646)
  * Split materialized view mutations on build to prevent OOM (CASSANDRA-12268)
  * mx4j does not work in 3.0.8 (CASSANDRA-12274)
  * Abort cqlsh copy-from in case of no answer after prolonged period of time 
(CASSANDRA-12740)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/6c640741/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 6a95e99..394ce6e 100644
--- a/src/java/org/apache/cassandra/tools/NodeProbe.java
+++ b/src/java/org/apache/cassandra/tools/NodeProbe.java
@@ -25,6 +25,7 @@ import java.lang.management.MemoryUsage;
 import java.lang.management.RuntimeMXBean;
 import java.net.InetAddress;
 import java.net.UnknownHostException;
+import java.rmi.ConnectException;
 import java.rmi.server.RMIClientSocketFactory;
 import java.rmi.server.RMISocketFactory;
 import java.util.AbstractMap;
@@ -224,7 +225,7 @@ public class NodeProbe implements AutoCloseable
                 mbeanServerConn, ManagementFactory.RUNTIME_MXBEAN_NAME, 
RuntimeMXBean.class);
     }
 
-    private RMIClientSocketFactory getRMIClientSocketFactory() throws 
IOException
+    private RMIClientSocketFactory getRMIClientSocketFactory()
     {
         if (Boolean.parseBoolean(System.getProperty("ssl.enable")))
             return new SslRMIClientSocketFactory();
@@ -234,7 +235,15 @@ public class NodeProbe implements AutoCloseable
 
     public void close() throws IOException
     {
-        jmxc.close();
+        try
+        {
+            jmxc.close();
+        }
+        catch (ConnectException e)
+        {
+            // result of 'stopdaemon' command - i.e. if close() call fails, 
the daemon is shutdown
+            System.out.println("Cassandra has shutdown.");
+        }
     }
 
     public int forceKeyspaceCleanup(int jobs, String keyspaceName, String... 
tables) throws IOException, ExecutionException, InterruptedException

http://git-wip-us.apache.org/repos/asf/cassandra/blob/6c640741/src/java/org/apache/cassandra/tools/nodetool/StopDaemon.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/tools/nodetool/StopDaemon.java 
b/src/java/org/apache/cassandra/tools/nodetool/StopDaemon.java
index a0af89f..79a499a 100644
--- a/src/java/org/apache/cassandra/tools/nodetool/StopDaemon.java
+++ b/src/java/org/apache/cassandra/tools/nodetool/StopDaemon.java
@@ -37,6 +37,5 @@ public class StopDaemon extends NodeToolCmd
             JVMStabilityInspector.inspectThrowable(e);
             // ignored
         }
-        System.out.println("Cassandra has shutdown.");
     }
-}
\ No newline at end of file
+}

Reply via email to