gpt4 book ai didi

org.apache.helix.manager.zk.ZkClient.readDataAndStat()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-14 11:14:49 26 4
gpt4 key购买 nike

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

ZkClient.readDataAndStat介绍

暂无

代码示例

代码示例来源:origin: apache/helix

private ZNRecord readZkChild(String zkPath, ZkClient zkClient) {
 ZNRecord result = null;
 // read data and stat
 Stat stat = new Stat();
 ZNRecord data = zkClient.readDataAndStat(zkPath, stat, true);
 if (data != null) {
  result = data;
 } else {
  result = new ZNRecord("");
 }
 // read childrenList
 List<String> children = zkClient.getChildren(zkPath);
 if (children != null && children.size() > 0) {
  result.setSimpleField("numChildren", "" + children.size());
  result.setListField("childrenList", children);
 } else {
  result.setSimpleField("numChildren", "" + 0);
 }
 return result;
}

代码示例来源:origin: org.apache.helix/helix-core

public static List<ZNRecord> getChildren(ZkClient client, String path) {
 // parent watch will be set by zkClient
 List<String> children = client.getChildren(path);
 if (children == null || children.size() == 0) {
  return Collections.emptyList();
 }
 List<ZNRecord> childRecords = new ArrayList<ZNRecord>();
 for (String child : children) {
  String childPath = path + "/" + child;
  Stat newStat = new Stat();
  ZNRecord record = client.readDataAndStat(childPath, newStat, true);
  if (record != null) {
   record.setVersion(newStat.getVersion());
   record.setCreationTime(newStat.getCtime());
   record.setModifiedTime(newStat.getMtime());
   childRecords.add(record);
  }
 }
 return childRecords;
}

代码示例来源:origin: apache/helix

private ZNRecord readZkDataStatAndChild(String zkPath, ZkClient zkClient) {
 ZNRecord result = null;
 // read data and stat
 Stat stat = new Stat();
 ZNRecord data = zkClient.readDataAndStat(zkPath, stat, true);
 if (data != null) {
  result = data;
 } else {
  result = new ZNRecord("");
 }
 result.setSimpleField("zkPath", zkPath);
 result.setSimpleField("stat", stat.toString());
 result.setSimpleField("numChildren", "" + stat.getNumChildren());
 result.setSimpleField("ctime", "" + new Date(stat.getCtime()));
 result.setSimpleField("mtime", "" + new Date(stat.getMtime()));
 result.setSimpleField("dataLength", "" + stat.getDataLength());
 // read childrenList
 List<String> children = zkClient.getChildren(zkPath);
 if (children != null && children.size() > 0) {
  result.setListField("children", children);
 }
 return result;
}

代码示例来源:origin: apache/helix

Assert.assertEquals((long) beanServer.getAttribute(idealStatename, "ReadBytesCounter"),
  TEST_DATA_SIZE);
zkClient.readDataAndStat(TEST_PATH, new Stat(), true);
Assert.assertEquals((long) beanServer.getAttribute(rootname, "ReadCounter"), 5);

代码示例来源:origin: org.apache.helix/helix-core

try {
 Stat stat = new Stat();
 ZNRecord record = zkClient.<ZNRecord> readDataAndStat(path, stat, true);

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