gpt4 book ai didi

org.I0Itec.zkclient.ZkClient.getChildren()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-17 12:30:40 26 4
gpt4 key购买 nike

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

ZkClient.getChildren介绍

暂无

代码示例

代码示例来源:origin: ltsopensource/light-task-scheduler

@Override
public List<String> getChildren(String path) {
  try {
    return zkClient.getChildren(path);
  } catch (ZkNoNodeException e) {
    return null;
  }
}

代码示例来源:origin: ltsopensource/light-task-scheduler

@Override
public List<String> getChildren(String path) {
  try {
    return zkClient.getChildren(path);
  } catch (ZkNoNodeException e) {
    return null;
  }
}

代码示例来源:origin: killme2008/Metamorphosis

public static List<String> getChildrenMaybeNull(final ZkClient client, final String path) {
  try {
    return client.getChildren(path);
  }
  catch (final ZkNoNodeException e) {
    return null;
  }
}

代码示例来源:origin: networknt/light-4j

@Override
public List<String> getChildren(String path) {
  return zkClient.getChildren(path);
}

代码示例来源:origin: killme2008/Metamorphosis

public static List<String> getChildren(final ZkClient client, final String path) {
  return client.getChildren(path);
}

代码示例来源:origin: apache/incubator-dubbo

public List<String> getChildren(String path) {
  Assert.notNull(client, new IllegalStateException("Zookeeper is not connected yet!"));
  return client.getChildren(path);
}

代码示例来源:origin: apache/incubator-dubbo

public List<String> getChildren(String path) {
  Assert.notNull(client, new IllegalStateException("Zookeeper is not connected yet!"));
  return client.getChildren(path);
}

代码示例来源:origin: crossoverJie/cim

/**
 * 获取所有注册节点
 * @return
 */
public List<String> getAllNode(){
  List<String> children = zkClient.getChildren("/route");
  logger.info("查询所有节点成功=【{}】", JSON.toJSONString(children));
  return children;
}

代码示例来源:origin: crossoverJie/cim

/**
 * 获取所有注册节点
 * @return
 */
public List<String> getAllNode(){
  List<String> children = zkClient.getChildren("/route");
  logger.info("查询所有节点成功=【{}】", JSON.toJSONString(children));
  return children;
}

代码示例来源:origin: weibocom/motan

private List<String> getChildren(String path) {
  List<String> children = new ArrayList<String>();
  if (zkClient.exists(path)) {
    children = zkClient.getChildren(path);
  }
  return children;
}

代码示例来源:origin: weibocom/motan

private List<String> getChildren(String path) {
    List<String> children = new ArrayList<String>();
    if (zkClient.exists(path)) {
      children = zkClient.getChildren(path);
    }
    return children;
  }
}

代码示例来源:origin: weibocom/motan

@Override
protected List<URL> discoverService(URL url) {
  try {
    String parentPath = ZkUtils.toNodeTypePath(url, ZkNodeType.AVAILABLE_SERVER);
    List<String> currentChilds = new ArrayList<>();
    if (zkClient.exists(parentPath)) {
      currentChilds = zkClient.getChildren(parentPath);
    }
    return nodeChildsToUrls(url, parentPath, currentChilds);
  } catch (Throwable e) {
    throw new MotanFrameworkException(String.format("Failed to discover service %s from zookeeper(%s), cause: %s", url, getUrl(), e.getMessage()), e);
  }
}

代码示例来源:origin: uber/chaperone

private void loadBlacklistedTopics() {
 _blacklistedTopics.clear();
 _blacklistedTopics.addAll(_zkClient.getChildren(_blacklistedTopicsZPath));
}

代码示例来源:origin: javahongxi/whatsmars

public List<String> getChildren(String path) {
  Assert.notNull(client, new IllegalStateException("Zookeeper is not connected yet!"));
  return client.getChildren(path);
}

代码示例来源:origin: uber/chaperone

Set<String> servingTopics;
try {
 servingTopics = ImmutableSet.copyOf(_zkClient.getChildren(KAFKA_TOPICS_PATH));
} catch (Exception e) {
 LOGGER.warn("Failed to get topics from kafka zk: {}", e);

代码示例来源:origin: Dromara/soul

private void loadWatchAppAuth() {
  final String appAuthParent = ZkPathConstants.APP_AUTH_PARENT;
  if (!zkClient.exists(appAuthParent)) {
    zkClient.createPersistent(appAuthParent, true);
  }
  final List<String> childrenList = zkClient.getChildren(appAuthParent);
  if (CollectionUtils.isNotEmpty(childrenList)) {
    childrenList.forEach(children -> {
      String realPath = buildRealPath(appAuthParent, children);
      final AppAuthZkDTO appAuthZkDTO = zkClient.readData(realPath);
      Optional.ofNullable(appAuthZkDTO)
          .ifPresent(dto -> AUTH_MAP.put(dto.getAppKey(), dto));
      subscribeAppAuthDataChanges(realPath);
    });
  }
  zkClient.subscribeChildChanges(appAuthParent, (parentPath, currentChilds) -> {
    if (CollectionUtils.isNotEmpty(currentChilds)) {
      final List<String> unsubscribePath = unsubscribePath(childrenList, currentChilds);
      unsubscribePath.stream().map(children -> buildRealPath(parentPath, children))
          .forEach(this::subscribeAppAuthDataChanges);
    }
  });
}

代码示例来源:origin: Dromara/soul

private void loadWatcherRule() {
  Arrays.stream(PluginEnum.values()).forEach(pluginEnum -> {
    final String ruleParent = ZkPathConstants.buildRuleParentPath(pluginEnum.getName());
    if (!zkClient.exists(ruleParent)) {
      zkClient.createPersistent(ruleParent, true);
    }
    final List<String> childrenList = zkClient.getChildren(ruleParent);
    if (CollectionUtils.isNotEmpty(childrenList)) {
      childrenList.forEach(children -> {
        String realPath = buildRealPath(ruleParent, children);
        final RuleZkDTO ruleZkDTO = zkClient.readData(realPath);
        Optional.ofNullable(ruleZkDTO)
            .ifPresent(dto -> {
              String key = dto.getSelectorId();
              setRuleMapByKey(key, ruleZkDTO);
            });
        subscribeRuleDataChanges(realPath);
      });
    }
    zkClient.subscribeChildChanges(ruleParent, (parentPath, currentChilds) -> {
      if (CollectionUtils.isNotEmpty(currentChilds)) {
        final List<String> unsubscribePath = unsubscribePath(childrenList, currentChilds);
        //获取新增的节点数据,并对该节点进行订阅
        unsubscribePath.stream().map(p -> buildRealPath(parentPath, p))
            .forEach(this::subscribeRuleDataChanges);
      }
    });
  });
}

代码示例来源:origin: Dromara/soul

private void loadWatcherSelector() {
  Arrays.stream(PluginEnum.values()).forEach(pluginEnum -> {
    //获取选择器的节点
    String selectorParentPath =
        ZkPathConstants.buildSelectorParentPath(pluginEnum.getName());
    if (!zkClient.exists(selectorParentPath)) {
      zkClient.createPersistent(selectorParentPath, true);
    }
    final List<String> childrenList = zkClient.getChildren(selectorParentPath);
    if (CollectionUtils.isNotEmpty(childrenList)) {
      childrenList.forEach(children -> {
        String realPath = buildRealPath(selectorParentPath, children);
        final SelectorZkDTO selectorZkDTO = zkClient.readData(realPath);
        Optional.ofNullable(selectorZkDTO)
            .ifPresent(dto -> {
              final String key = dto.getPluginName();
              setSelectorMapByKey(key, dto);
            });
        subscribeSelectorDataChanges(realPath);
      });
    }
    zkClient.subscribeChildChanges(selectorParentPath, (parentPath, currentChilds) -> {
      if (CollectionUtils.isNotEmpty(currentChilds)) {
        final List<String> unsubscribePath = unsubscribePath(childrenList, currentChilds);
        unsubscribePath.stream().map(p -> buildRealPath(parentPath, p))
            .forEach(this::subscribeSelectorDataChanges);
      }
    });
  });
}

代码示例来源:origin: Dromara/soul

List<PluginDO> pluginDOs = pluginMapper.selectByQuery(new PluginQuery());
if (CollectionUtils.isNotEmpty(pluginDOs)) {
  List<String> pluginZKs = zkClient.getChildren(ZkPathConstants.buildPluginParentPath());
  pluginDOs.forEach(pluginDO -> {
    if (CollectionUtils.isNotEmpty(pluginZKs)) {

代码示例来源:origin: Dromara/soul

pluginDO.getName(), pluginDO.getEnabled()));
List<String> selectorZKs = zkClient.getChildren(ZkPathConstants.buildSelectorParentPath(pluginDO.getName()));
selectorMapper.selectByQuery(new SelectorQuery(pluginDO.getId(), null)).forEach(selectorDO -> {
  if (CollectionUtils.isNotEmpty(selectorZKs)) {
      selectorDO.getLoged(), selectorDO.getContinued(), selectorDO.getHandle(), selectorConditionZkDTOs));
  List<String> ruleZKs = zkClient.getChildren(ZkPathConstants.buildRuleParentPath(pluginDO.getName()));
  ruleMapper.selectByQuery(new RuleQuery(selectorDO.getId(), null)).forEach(ruleDO -> {
    if (CollectionUtils.isNotEmpty(ruleZKs)) {
  zkClient.delete(ZkPathConstants.buildSelectorRealPath(pluginDO.getName(), selectorZK));
  String ruleParentPath = ZkPathConstants.buildRuleParentPath(pluginDO.getName());
  zkClient.getChildren(ruleParentPath).forEach(selectorRulePath -> {
    if (selectorRulePath.split(ZkPathConstants.SELECTOR_JOIN_RULE)[0].equals(selectorZK)) {
      zkClient.delete(ruleParentPath + "/" + selectorRulePath);

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