gpt4 book ai didi

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

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

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

ZkPathConstants.buildPluginPath介绍

[英]buildPluginRealPath.
[中]buildPluginRealPath。

代码示例

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

private void loadWatcherPlugin() {
  Arrays.stream(PluginEnum.values()).forEach(pluginEnum -> {
    String pluginPath = ZkPathConstants.buildPluginPath(pluginEnum.getName());
    if (!zkClient.exists(pluginPath)) {
      zkClient.createPersistent(pluginPath, true);
    }
    PluginZkDTO data = zkClient.readData(pluginPath);
    Optional.ofNullable(data).ifPresent(d -> PLUGIN_MAP.put(pluginEnum.getName(), data));
    zkClient.subscribeDataChanges(pluginPath, new IZkDataListener() {
      @Override
      public void handleDataChange(final String dataPath, final Object data) {
        Optional.ofNullable(data)
            .ifPresent(o -> {
              PluginZkDTO dto = (PluginZkDTO) o;
              PLUGIN_MAP.put(dto.getName(), dto);
            });
      }
      @Override
      public void handleDataDeleted(final String dataPath) {
        PLUGIN_MAP.remove(pluginEnum.getName());
      }
    });
  });
}

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

zkClient.delete(ZkPathConstants.buildPluginPath(pluginZK));
String selectorParentPath = ZkPathConstants.buildSelectorParentPath(pluginZK);
if (zkClient.exists(selectorParentPath)) {

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

/**
 * create or update plugin.
 *
 * @param pluginDTO {@linkplain PluginDTO}
 * @return rows
 */
@Override
@Transactional(rollbackFor = Exception.class)
public int createOrUpdate(final PluginDTO pluginDTO) {
  int pluginCount;
  PluginDO pluginDO = PluginDO.buildPluginDO(pluginDTO);
  if (StringUtils.isEmpty(pluginDTO.getId())) {
    pluginCount = pluginMapper.insertSelective(pluginDO);
  } else {
    pluginCount = pluginMapper.updateSelective(pluginDO);
  }
  String pluginPath = ZkPathConstants.buildPluginPath(pluginDO.getName());
  if (!zkClient.exists(pluginPath)) {
    zkClient.createPersistent(pluginPath, true);
  }
  zkClient.writeData(pluginPath, new PluginZkDTO(pluginDO.getId(),
      pluginDO.getName(), pluginDO.getEnabled()));
  return pluginCount;
}

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

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

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