org.apache.hadoop.util.curator.ZKCuratorManager.create()方法的使用及代码示例

x33g5p2x  于2022-02-05 转载在 其他  
字(1.7k)|赞(0)|评价(0)|浏览(79)

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

ZKCuratorManager.create介绍

[英]Create a ZNode.
[中]创建一个ZNode。

代码示例

代码示例来源:origin: org.apache.hadoop/hadoop-common

/**
 * Create a ZNode.
 * @param path Path of the ZNode.
 * @return If the ZNode was created.
 * @throws Exception If it cannot contact Zookeeper.
 */
public boolean create(final String path) throws Exception {
 return create(path, null);
}

代码示例来源:origin: org.apache.hadoop/hadoop-yarn-server-resourcemanager

zkManager.create(logsPath);
zkManager.setData(logsPath,
  serializeObject(new LinkedList<LogMutation>()), -1);
zkManager.create(confStorePath);
HashMap<String, String> mapSchedConf = new HashMap<>();
for (Map.Entry<String, String> entry : schedConf) {

代码示例来源:origin: org.apache.hadoop/hadoop-common

/**
 * Utility function to ensure that the configured base znode exists.
 * This recursively creates the znode as well as all of its parents.
 * @param path Path of the znode to create.
 * @param zkAcl ACLs for ZooKeeper.
 * @throws Exception If it cannot create the file.
 */
public void createRootDirRecursively(String path, List<ACL> zkAcl)
  throws Exception {
 String[] pathParts = path.split("/");
 Preconditions.checkArgument(
   pathParts.length >= 1 && pathParts[0].isEmpty(),
   "Invalid path: %s", path);
 StringBuilder sb = new StringBuilder();
 for (int i = 1; i < pathParts.length; i++) {
  sb.append("/").append(pathParts[i]);
  create(sb.toString(), zkAcl);
 }
}

代码示例来源:origin: org.apache.hadoop/hadoop-yarn-server-resourcemanager

@VisibleForTesting
void create(final String path) throws Exception {
 zkManager.create(path, zkAcl);
}

相关文章