gpt4 book ai didi

com.addthis.hydra.job.store.ZookeeperDataStore.getChildrenNames()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-13 12:34:36 26 4
gpt4 key购买 nike

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

ZookeeperDataStore.getChildrenNames介绍

暂无

代码示例

代码示例来源:origin: addthis/hydra

@Override
public Map<String, String> getAllChildren(String path) {
  Map<String, String> rv = new HashMap<>();
  List<String> children = getChildrenNames(path);
  if (children != null) {
    for (String child : children) {
      try {
        rv.put(child, getChild(path, child));
      } catch (Exception ex) {
        log.warn("Failed to fetch child " + child + " of " + path + ": " + ex, ex);
      }
    }
  }
  return rv;
}

代码示例来源:origin: addthis/hydra

/**
   * Write some children to a specified location. Make sure their respective data is held intact, and that the list
   * of children updates correctly after nodes are added or deleted.
   */
  @Test public void crudChildren() throws Exception {
    String savePath = "/other/path";
    try {
      String c1 = "child1";
      String c2 = "child2";
      spawnDataStore.delete(savePath);
      spawnDataStore.putAsChild(savePath, c1, "data1");
      spawnDataStore.putAsChild(savePath, c1, "data1_updated");
      spawnDataStore.putAsChild(savePath, c2, "data2");
      Set<String> bothChildren = Sets.newHashSet(spawnDataStore.getChildrenNames(savePath));
      assertEquals("should get correct children", bothChildren, Sets.newHashSet(c1, c2));
      assertEquals("should get updated value for c1", "data1_updated", spawnDataStore.getChild(savePath, c1));
      spawnDataStore.deleteChild(savePath, c2);
      Set<String> oneChild = Sets.newHashSet(spawnDataStore.getChildrenNames(savePath));
      assertEquals("should get new correct children", oneChild, Sets.newHashSet(c1));
      assertEquals("c1 should be intact", "data1_updated", spawnDataStore.getChild(savePath, c1));
      spawnDataStore.delete(savePath);
      assertNull("should get no children", spawnDataStore.getChildrenNames(savePath));
    } finally {
      spawnDataStore.delete(savePath);
    }
  }
}

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