gpt4 book ai didi

org.dromara.soul.common.constant.ZkPathConstants.buildRuleParentPath()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-20 17:54:31 25 4
gpt4 key购买 nike

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

ZkPathConstants.buildRuleParentPath介绍

[英]buildRuleParentPath.
[中]构建规则父路径。

代码示例

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

/**
 * buildRulePath.
 *
 * @param pluginName pluginName
 * @param selectorId selectorId
 * @param ruleId     ruleId
 * @return /soul/rule/pluginName/selectorId-ruleId
 */
public static String buildRulePath(final String pluginName, final String selectorId, final String ruleId) {
  return String.join("/", buildRuleParentPath(pluginName), selectorId + SELECTOR_JOIN_RULE + ruleId);
}

代码示例来源: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

zkClient.delete(selectorParentPath);
String ruleParentPath = ZkPathConstants.buildRuleParentPath(pluginZK);
if (zkClient.exists(ruleParentPath)) {
  zkClient.delete(ruleParentPath);

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

String ruleParentPath = ZkPathConstants.buildRuleParentPath(pluginDO.getName());
if (!zkClient.exists(ruleParentPath)) {
  zkClient.createPersistent(ruleParentPath, true);

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

/**
 * delete plugins.
 *
 * @param ids primary key.
 * @return rows
 */
@Override
@Transactional(rollbackFor = Exception.class)
public int delete(final List<String> ids) {
  int pluginCount = 0;
  for (String id : ids) {
    PluginDO pluginDO = pluginMapper.selectById(id);
    pluginCount += pluginMapper.delete(id);
    String pluginPath = ZkPathConstants.buildPluginPath(pluginDO.getName());
    if (zkClient.exists(pluginPath)) {
      zkClient.delete(pluginPath);
    }
    String selectorParentPath = ZkPathConstants.buildSelectorParentPath(pluginDO.getName());
    if (zkClient.exists(selectorParentPath)) {
      zkClient.delete(selectorParentPath);
    }
    String ruleParentPath = ZkPathConstants.buildRuleParentPath(pluginDO.getName());
    if (zkClient.exists(ruleParentPath)) {
      zkClient.delete(ruleParentPath);
    }
  }
  return pluginCount;
}

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

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)) {
String ruleParentPath = ZkPathConstants.buildRuleParentPath(pluginDO.getName());
zkClient.getChildren(ruleParentPath).forEach(selectorRulePath -> {
  if (selectorRulePath.split(ZkPathConstants.SELECTOR_JOIN_RULE)[0].equals(selectorZK)) {

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