gpt4 book ai didi

com.netflix.curator.utils.ZKPaths.getPathAndNode()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-13 13:18:22 25 4
gpt4 key购买 nike

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

ZKPaths.getPathAndNode介绍

[英]Given a full path, return the node name and its path. i.e. "/one/two/three" will return {"/one/two", "three"}
[中]给定完整路径,返回节点名称及其路径。i、 e.“/one/two/three”将返回{/one/two”,“three”}

代码示例

代码示例来源:origin: com.netflix.curator/curator-recipes

/**
 * NOTE: this is a BLOCKING method. Rebuild the internal cache for the given node by querying
 * for all needed data WITHOUT generating any events to send to listeners.
 *
 * @param fullPath full path of the node to rebuild
 * @throws Exception errors
 */
public void rebuildNode(String fullPath) throws Exception
{
  Preconditions.checkArgument(ZKPaths.getPathAndNode(fullPath).getPath().equals(path), "Node is not part of this cache: " + fullPath);
  Preconditions.checkState(!executorService.isShutdown(), "cache has been closed");
  ensurePath.ensure(client.getZookeeperClient());
  internalRebuildNode(fullPath);
  // this is necessary so that any updates that occurred while rebuilding are taken
  // have to rebuild entire tree in case this node got deleted in the interim
  offerOperation(new RefreshOperation(this, RefreshMode.FORCE_GET_DATA_AND_STAT));
}

代码示例来源:origin: com.netflix.curator/curator-framework

private String  adjustPath(String path) throws Exception
  {
    if ( doProtected )
    {
      ZKPaths.PathAndNode     pathAndNode = ZKPaths.getPathAndNode(path);
      String                  name = getProtectedPrefix() + pathAndNode.getNode();
      path = ZKPaths.makePath(pathAndNode.getPath(), name);
    }
    return path;
  }
}

代码示例来源:origin: com.netflix.curator/curator-framework

try
  final ZKPaths.PathAndNode   pathAndNode = ZKPaths.getPathAndNode(path);
  List<String>                children = client.getZooKeeper().getChildren(pathAndNode.getPath(), false);

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