本文整理了Java中org.apache.hadoop.hbase.zookeeper.ZKNodeTracker.getData()
方法的一些代码示例,展示了ZKNodeTracker.getData()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZKNodeTracker.getData()
方法的具体详情如下:
包路径:org.apache.hadoop.hbase.zookeeper.ZKNodeTracker
类名称:ZKNodeTracker
方法名:getData
[英]Gets the data of the node.
If the node is currently available, the most up-to-date known version of the data is returned. If the node is not currently available, null is returned.
[中]获取节点的数据。
如果节点当前可用,则返回已知的最新数据版本。如果节点当前不可用,则返回null。
代码示例来源:origin: apache/hbase
/**
* Check if there is a master available.
* @return true if there is a master set, false if not.
*/
public boolean hasMaster() {
return super.getData(false) != null;
}
代码示例来源:origin: apache/hbase
/**
* Checks if cluster is up.
* @return true if the cluster up ('shutdown' is its name up in zk) znode
* exists with data, false if not
*/
public boolean isClusterUp() {
return super.getData(false) != null;
}
代码示例来源:origin: apache/hbase
/**
* Get the address of the current master if one is available. Returns null
* if no current master. If refresh is set, try to load the data from ZK again,
* otherwise, cached data will be used.
*
* @param refresh whether to refresh the data by calling ZK directly.
* @return Server name or null if timed out.
*/
public ServerName getMasterAddress(final boolean refresh) {
try {
return ProtobufUtil.parseServerNameFrom(super.getData(refresh));
} catch (DeserializationException e) {
LOG.warn("Failed parse", e);
return null;
}
}
代码示例来源:origin: apache/hbase
/**
* Return true if the switch is on, false otherwise
*/
public boolean isSwitchEnabled() {
byte [] upData = super.getData(false);
try {
// if data in ZK is null, use default of on.
return upData == null || parseFrom(upData).getEnabled();
} catch (DeserializationException dex) {
LOG.error("ZK state for LoadBalancer could not be parsed " + Bytes.toStringBinary(upData));
// return false to be safe.
return false;
}
}
代码示例来源:origin: apache/hbase
/**
* Return true if the balance switch is on, false otherwise
*/
public boolean isBalancerOn() {
byte [] upData = super.getData(false);
try {
// if data in ZK is null, use default of on.
return upData == null || parseFrom(upData).getBalancerOn();
} catch (DeserializationException dex) {
LOG.error("ZK state for LoadBalancer could not be parsed " + Bytes.toStringBinary(upData));
// return false to be safe.
return false;
}
}
代码示例来源:origin: apache/hbase
/**
* Return true if region normalizer is on, false otherwise
*/
public boolean isNormalizerOn() {
byte [] upData = super.getData(false);
try {
// if data in ZK is null, use default of on.
return upData == null || parseFrom(upData).getNormalizerOn();
} catch (DeserializationException dex) {
LOG.error("ZK state for RegionNormalizer could not be parsed "
+ Bytes.toStringBinary(upData));
// return false to be safe.
return false;
}
}
代码示例来源:origin: org.apache.hbase/hbase-zookeeper
/**
* Checks if cluster is up.
* @return true if the cluster up ('shutdown' is its name up in zk) znode
* exists with data, false if not
*/
public boolean isClusterUp() {
return super.getData(false) != null;
}
代码示例来源:origin: org.apache.hbase/hbase-zookeeper
/**
* Check if there is a master available.
* @return true if there is a master set, false if not.
*/
public boolean hasMaster() {
return super.getData(false) != null;
}
代码示例来源:origin: org.apache.hbase/hbase-zookeeper
/**
* Get the address of the current master if one is available. Returns null
* if no current master. If refresh is set, try to load the data from ZK again,
* otherwise, cached data will be used.
*
* @param refresh whether to refresh the data by calling ZK directly.
* @return Server name or null if timed out.
*/
public ServerName getMasterAddress(final boolean refresh) {
try {
return ProtobufUtil.parseServerNameFrom(super.getData(refresh));
} catch (DeserializationException e) {
LOG.warn("Failed parse", e);
return null;
}
}
代码示例来源:origin: org.apache.hbase/hbase-zookeeper
/**
* Return true if the balance switch is on, false otherwise
*/
public boolean isBalancerOn() {
byte [] upData = super.getData(false);
try {
// if data in ZK is null, use default of on.
return upData == null || parseFrom(upData).getBalancerOn();
} catch (DeserializationException dex) {
LOG.error("ZK state for LoadBalancer could not be parsed " + Bytes.toStringBinary(upData));
// return false to be safe.
return false;
}
}
代码示例来源:origin: org.apache.hbase/hbase-zookeeper
/**
* Return true if region normalizer is on, false otherwise
*/
public boolean isNormalizerOn() {
byte [] upData = super.getData(false);
try {
// if data in ZK is null, use default of on.
return upData == null || parseFrom(upData).getNormalizerOn();
} catch (DeserializationException dex) {
LOG.error("ZK state for RegionNormalizer could not be parsed "
+ Bytes.toStringBinary(upData));
// return false to be safe.
return false;
}
}
内容来源于网络,如有侵权,请联系作者删除!