com.indeed.util.zookeeper.ZooKeeperConnection.createFullPath()方法的使用及代码示例

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

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

ZooKeeperConnection.createFullPath介绍

暂无

代码示例

代码示例来源:origin: indeedeng/util

public static void createFullPath(ZooKeeperConnection zooKeeperConnection, String path, byte[] value, CreateMode createMode)
    throws InterruptedException, KeeperException {
  createFullPath(zooKeeperConnection, path, value, createMode, false);
}

代码示例来源:origin: indeedeng/util

public boolean createFullPath(String path, byte[] value, CreateMode createMode, boolean ignoreIfExists) throws KeeperException, InterruptedException {
  return createFullPath(this, path, value, createMode, ignoreIfExists);
}

代码示例来源:origin: indeedeng/util

public void createFullPath(String path, byte[] value, CreateMode createMode) throws KeeperException, InterruptedException {
  createFullPath(this, path, value, createMode);
}

代码示例来源:origin: indeedeng/util

public static void updateOrCreate(ZooKeeperConnection zooKeeper, String path, byte[] value, CreateMode createMode)
    throws InterruptedException, KeeperException {
  boolean success = false;
  if (zooKeeper.exists(path, false) == null) {
    success = createFullPath(zooKeeper, path, value, createMode, true);
  }
  if (!success) zooKeeper.setData(path, value, -1);
}

代码示例来源:origin: indeedeng/imhotep

private void createNode() {
  boolean created = false;
  while (!created) {
    try {
      try {
        zkConnection.connect();
        ZooKeeperConnection.createFullPath(zkConnection, rootPath, new byte[0], CreateMode.PERSISTENT, true);
        zkConnection.create(rootPath + "/"+nodeName, data, ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.EPHEMERAL);
        created = true;
      } catch (IOException e) {
        log.error(e);
        Thread.sleep(TIMEOUT);
      } catch (KeeperException e) {
        log.error(e);
        zkConnection.close();
        Thread.sleep(TIMEOUT);
      }
    } catch (InterruptedException e) {
      log.error(e);
    }
  }
}

相关文章