gpt4 book ai didi

org.apache.hadoop.hbase.zookeeper.ZKNodeTracker.getData()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-13 09:46:40 28 4
gpt4 key购买 nike

本文整理了Java中org.apache.hadoop.hbase.zookeeper.ZKNodeTracker.getData()方法的一些代码示例,展示了ZKNodeTracker.getData()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZKNodeTracker.getData()方法的具体详情如下:
包路径:org.apache.hadoop.hbase.zookeeper.ZKNodeTracker
类名称:ZKNodeTracker
方法名:getData

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;
 }
}

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com