HBASE-5638 Readability improvements on HBASE-5633: NPE reading ZK config in HBase (Matteo Bertozzi)
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1307085 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
26de676dea
commit
fbfe3f29e5
|
@ -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";
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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.";
|
||||
|
|
Loading…
Reference in New Issue