cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject git commit: Nodetool and CLI connect to localhost by default patch by Rick Branson; reviewed by jbellis for CASSANDRA-3568
Date Thu, 26 Jan 2012 01:31:33 GMT
Updated Branches:
  refs/heads/trunk cf0b69ff5 -> eec230926


Nodetool and CLI connect to localhost by default
patch by Rick Branson; reviewed by jbellis for CASSANDRA-3568


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

Branch: refs/heads/trunk
Commit: eec2309266be044acd4538a9b445301ae3a02f41
Parents: cf0b69f
Author: Jonathan Ellis <jbellis@apache.org>
Authored: Wed Jan 25 19:15:01 2012 -0600
Committer: Jonathan Ellis <jbellis@apache.org>
Committed: Wed Jan 25 19:15:01 2012 -0600

----------------------------------------------------------------------
 CHANGES.txt                                       |    1 +
 src/java/org/apache/cassandra/cli/CliMain.java    |    2 --
 src/java/org/apache/cassandra/cli/CliOptions.java |    6 ++----
 src/java/org/apache/cassandra/tools/NodeCmd.java  |    7 +++++--
 4 files changed, 8 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/eec23092/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 74ee0e9..082ca73 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 1.1-dev
+ * Nodetool and CLI connect to localhost by default (CASSANDRA-3568)
  * Reduce memory used by primary index sample (CASSANDRA-3743)
  * (Hadoop) separate input/output configurations (CASSANDRA-3197, 3765)
  * avoid returning internal Cassandra classes over JMX (CASSANDRA-2805)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/eec23092/src/java/org/apache/cassandra/cli/CliMain.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cli/CliMain.java b/src/java/org/apache/cassandra/cli/CliMain.java
index b83728d..5d2e633 100644
--- a/src/java/org/apache/cassandra/cli/CliMain.java
+++ b/src/java/org/apache/cassandra/cli/CliMain.java
@@ -57,7 +57,6 @@ public class CliMain
      */
     public static void connect(String server, int port)
     {
-
         TSocket socket = new TSocket(server, port);
 
         if (transport != null)
@@ -258,7 +257,6 @@ public class CliMain
             catch (RuntimeException e)
             {
                 sessionState.err.println(e.getMessage());
-                System.exit(-1);
             }
         }
         

http://git-wip-us.apache.org/repos/asf/cassandra/blob/eec23092/src/java/org/apache/cassandra/cli/CliOptions.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cli/CliOptions.java b/src/java/org/apache/cassandra/cli/CliOptions.java
index c3cfab6..7f13347 100644
--- a/src/java/org/apache/cassandra/cli/CliOptions.java
+++ b/src/java/org/apache/cassandra/cli/CliOptions.java
@@ -47,6 +47,7 @@ public class CliOptions
     private static final String SCHEMA_MIGRATION_WAIT_TIME = "schema-mwt";
 
     // Default values for optional command line arguments
+    private static final String DEFAULT_HOST        = "127.0.0.1";
     private static final int    DEFAULT_THRIFT_PORT = 9160;
 
     // Register the command line options and their properties (such as
@@ -91,10 +92,7 @@ public class CliOptions
             }
             else
             {
-                // host name not specified in command line.
-                // In this case, we don't implicitly connect at CLI startup. In this case,
-                // the user must use the "connect" CLI statement to connect.
-                css.hostName = null;
+                css.hostName = DEFAULT_HOST;
             }
 
             // Look to see if frame has been specified

http://git-wip-us.apache.org/repos/asf/cassandra/blob/eec23092/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 22939db..7692cd0 100644
--- a/src/java/org/apache/cassandra/tools/NodeCmd.java
+++ b/src/java/org/apache/cassandra/tools/NodeCmd.java
@@ -53,6 +53,8 @@ public class NodeCmd
     private static final Pair<String, String> PASSWORD_OPT = new Pair<String, String>("pw",
"password");
     private static final Pair<String, String> TAG_OPT = new Pair<String, String>("t",
"tag");
     private static final Pair<String, String> PRIMARY_RANGE_OPT = new Pair<String,
String>("pr", "partitioner-range");
+
+    private static final String DEFAULT_HOST = "127.0.0.1";
     private static final int DEFAULT_PORT = 7199;
 
     private static ToolOptions options = null;
@@ -63,7 +65,7 @@ public class NodeCmd
     {
         options = new ToolOptions();
 
-        options.addOption(HOST_OPT,     true, "node hostname or ip address", true);
+        options.addOption(HOST_OPT,     true, "node hostname or ip address");
         options.addOption(PORT_OPT,     true, "remote jmx agent port number");
         options.addOption(USERNAME_OPT, true, "remote jmx agent username");
         options.addOption(PASSWORD_OPT, true, "remote jmx agent password");
@@ -598,7 +600,8 @@ public class NodeCmd
             badUse(p.getMessage());
         }
 
-        String host = cmd.getOptionValue(HOST_OPT.left);
+        String host = cmd.hasOption(HOST_OPT.left) ? cmd.getOptionValue(HOST_OPT.left) :
DEFAULT_HOST;
+
         int port = DEFAULT_PORT;
         
         String portNum = cmd.getOptionValue(PORT_OPT.left);


Mime
View raw message