cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dbros...@apache.org
Subject git commit: support username/password for for jmx in shuffle tool patch by mmichalski reviewed by dbrosius for cassandra-5431
Date Tue, 09 Apr 2013 03:21:04 GMT
Updated Branches:
  refs/heads/cassandra-1.2 2e96d0711 -> fe8939075


support username/password for for jmx in shuffle tool
patch by mmichalski reviewed by dbrosius for cassandra-5431


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

Branch: refs/heads/cassandra-1.2
Commit: fe8939075999359b8a26a1a0dcf1a7c7bc4531bb
Parents: 2e96d07
Author: Dave Brosius <dbrosius@apache.org>
Authored: Mon Apr 8 23:17:37 2013 -0400
Committer: Dave Brosius <dbrosius@apache.org>
Committed: Mon Apr 8 23:17:37 2013 -0400

----------------------------------------------------------------------
 .../apache/cassandra/tools/AbstractJmxClient.java  |   11 ++++++-----
 src/java/org/apache/cassandra/tools/Shuffle.java   |   11 +++++++----
 2 files changed, 13 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/fe893907/src/java/org/apache/cassandra/tools/AbstractJmxClient.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/tools/AbstractJmxClient.java b/src/java/org/apache/cassandra/tools/AbstractJmxClient.java
index 3d5cd3a..8241a5b 100644
--- a/src/java/org/apache/cassandra/tools/AbstractJmxClient.java
+++ b/src/java/org/apache/cassandra/tools/AbstractJmxClient.java
@@ -47,6 +47,8 @@ public abstract class AbstractJmxClient implements Closeable
 
     protected final String host;
     protected final int port;
+    protected final String username;
+    protected final String password;
     protected JMXConnection jmxConn;
     protected PrintStream out = System.out;
 
@@ -54,6 +56,8 @@ public abstract class AbstractJmxClient implements Closeable
     {
         options.addOption("h", "host", true,  "JMX hostname or IP address (Default: localhost)");
         options.addOption("p", "port", true,  "JMX port number (Default: 7199)");
+        options.addOption("u", "username", true,  "JMX username");
+        options.addOption("pw", "password", true,  "JMX password");
         options.addOption("H", "help", false, "Print help information");
     }
 
@@ -61,6 +65,8 @@ public abstract class AbstractJmxClient implements Closeable
     {
         this.host = (host != null) ? host : DEFAULT_HOST;
         this.port = (port != null) ? port : DEFAULT_JMX_PORT;
+        this.username = username;
+        this.password = password;
         jmxConn = new JMXConnection(this.host, this.port, username, password);
     }
 
@@ -133,11 +139,6 @@ class JMXConnection
     private JMXConnector jmxc;
     private MBeanServerConnection mbeanServerConn;
 
-    JMXConnection(String host, int port) throws IOException
-    {
-        this(host, port, null, null);
-    }
-
     JMXConnection(String host, int port, String username, String password) throws IOException
     {
         this.host = host;

http://git-wip-us.apache.org/repos/asf/cassandra/blob/fe893907/src/java/org/apache/cassandra/tools/Shuffle.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/tools/Shuffle.java b/src/java/org/apache/cassandra/tools/Shuffle.java
index 8cf38b9..793d2ee 100644
--- a/src/java/org/apache/cassandra/tools/Shuffle.java
+++ b/src/java/org/apache/cassandra/tools/Shuffle.java
@@ -233,7 +233,7 @@ public class Shuffle extends AbstractJmxClient
         {
             try
             {
-                JMXConnection conn = new JMXConnection(endpoint, port);
+                JMXConnection conn = new JMXConnection(endpoint, port, username, password);
                 getSSProxy(conn.getMbeanServerConn()).enableScheduledRangeXfers();
                 conn.close();
             }
@@ -265,7 +265,7 @@ public class Shuffle extends AbstractJmxClient
         {
             try
             {
-                JMXConnection conn = new JMXConnection(endpoint, port);
+                JMXConnection conn = new JMXConnection(endpoint, port, username, password);
                 getSSProxy(conn.getMbeanServerConn()).disableScheduledRangeXfers();
                 conn.close();
             }
@@ -286,7 +286,7 @@ public class Shuffle extends AbstractJmxClient
     {
         try
         {
-            JMXConnection conn = new JMXConnection(host, port);
+            JMXConnection conn = new JMXConnection(host, port, username, password);
             return getSSProxy(conn.getMbeanServerConn()).getLiveNodes();
         }
         catch (IOException e)
@@ -631,6 +631,8 @@ public class Shuffle extends AbstractJmxClient
 
         String hostName = (cmd.getOptionValue("host") != null) ? cmd.getOptionValue("host")
: DEFAULT_HOST;
         String port = (cmd.getOptionValue("port") != null) ? cmd.getOptionValue("port") :
Integer.toString(DEFAULT_JMX_PORT);
+        String username = cmd.getOptionValue("username");
+        String password = cmd.getOptionValue("password");
         String thriftHost = (cmd.getOptionValue("thrift-host") != null) ? cmd.getOptionValue("thrift-host")
: hostName;
         String thriftPort = (cmd.getOptionValue("thrift-port") != null) ? cmd.getOptionValue("thrift-port")
: "9160";
         String onlyDc = cmd.getOptionValue("only-dc");
@@ -670,7 +672,8 @@ public class Shuffle extends AbstractJmxClient
         else
             thriftPortNum = 9160;
 
-        Shuffle shuffler = new Shuffle(hostName, portNum, thriftHost, thriftPortNum, thriftFramed,
null, null);
+        Shuffle shuffler = new Shuffle(hostName, portNum, thriftHost, thriftPortNum, thriftFramed,
+                username, password);
 
         try
         {


Mime
View raw message