hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmhs...@apache.org
Subject svn commit: r1307085 - in /hbase/trunk/src/main/java/org/apache/hadoop/hbase: HConstants.java LocalHBaseCluster.java zookeeper/ZKConfig.java
Date Thu, 29 Mar 2012 20:04:49 GMT
Author: jmhsieh
Date: Thu Mar 29 20:04:49 2012
New Revision: 1307085

URL: http://svn.apache.org/viewvc?rev=1307085&view=rev
Log:
HBASE-5638 Readability improvements on HBASE-5633: NPE reading ZK config in HBase (Matteo
Bertozzi)

Modified:
    hbase/trunk/src/main/java/org/apache/hadoop/hbase/HConstants.java
    hbase/trunk/src/main/java/org/apache/hadoop/hbase/LocalHBaseCluster.java
    hbase/trunk/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKConfig.java

Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/HConstants.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/HConstants.java?rev=1307085&r1=1307084&r2=1307085&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/HConstants.java (original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/HConstants.java Thu Mar 29 20:04:49
2012
@@ -77,13 +77,13 @@ public final class HConstants {
   public static final String HBASE_MASTER_LOADBALANCER_CLASS = "hbase.master.loadbalancer.class";
 
   /** Cluster is standalone or pseudo-distributed */
-  public static final String CLUSTER_IS_LOCAL = "false";
+  public static final boolean CLUSTER_IS_LOCAL = false;
 
   /** Cluster is fully-distributed */
-  public static final String CLUSTER_IS_DISTRIBUTED = "true";
+  public static final boolean CLUSTER_IS_DISTRIBUTED = true;
 
   /** Default value for cluster distributed mode */  
-  public static final String DEFAULT_CLUSTER_DISTRIBUTED = CLUSTER_IS_LOCAL;
+  public static final boolean DEFAULT_CLUSTER_DISTRIBUTED = CLUSTER_IS_LOCAL;
 
   /** default host address */
   public static final String DEFAULT_HOST = "0.0.0.0";

Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/LocalHBaseCluster.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/LocalHBaseCluster.java?rev=1307085&r1=1307084&r2=1307085&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/LocalHBaseCluster.java (original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/LocalHBaseCluster.java Thu Mar 29 20:04:49
2012
@@ -436,8 +436,8 @@ public class LocalHBaseCluster {
    * @return True if a 'local' address in hbase.master value.
    */
   public static boolean isLocal(final Configuration c) {
-    final String mode = c.get(HConstants.CLUSTER_DISTRIBUTED);
-    return mode == null || mode.equals(HConstants.CLUSTER_IS_LOCAL);
+    boolean mode = c.getBoolean(HConstants.CLUSTER_DISTRIBUTED, HConstants.DEFAULT_CLUSTER_DISTRIBUTED);
+    return(mode == HConstants.CLUSTER_IS_LOCAL);
   }
 
   /**

Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKConfig.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKConfig.java?rev=1307085&r1=1307084&r2=1307085&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKConfig.java (original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKConfig.java Thu Mar 29 20:04:49
2012
@@ -163,9 +163,8 @@ public class ZKConfig {
       }
       // Special case for 'hbase.cluster.distributed' property being 'true'
       if (key.startsWith("server.")) {
-        if (conf.get(HConstants.CLUSTER_DISTRIBUTED, HConstants.DEFAULT_CLUSTER_DISTRIBUTED).
-              equals(HConstants.CLUSTER_IS_DISTRIBUTED)
-            && value.startsWith(HConstants.LOCALHOST)) {
+        boolean mode = conf.getBoolean(HConstants.CLUSTER_DISTRIBUTED, HConstants.DEFAULT_CLUSTER_DISTRIBUTED);
+        if (mode == HConstants.CLUSTER_IS_DISTRIBUTED && value.startsWith(HConstants.LOCALHOST))
{
           String msg = "The server in zoo.cfg cannot be set to localhost " +
               "in a fully-distributed setup because it won't be reachable. " +
               "See \"Getting Started\" for more information.";



Mime
View raw message