gpt4 book ai didi

com.ngdata.sep.util.zookeeper.ZkUtil.createPath()方法的使用及代码示例

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

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

ZkUtil.createPath介绍

[英]Creates a persistent path on zookeeper if it does not exist yet, including any parents. Keeps retrying in case of connection loss.

The supplied data is used for the last node in the path. If the path already exists, the data is updated if necessary.
[中]在zookeeper上创建一个持久路径(如果它还不存在),包括任何父级。在连接丢失的情况下不断重试。
提供的数据用于路径中的最后一个节点。如果路径已经存在,则在必要时更新数据。

代码示例

代码示例来源:origin: com.ngdata/hbase-sep-impl-common

public static void createPath(final ZooKeeperItf zk, final String path)
    throws InterruptedException, KeeperException {
  createPath(zk, path, null);
}

代码示例来源:origin: NGDATA/hbase-indexer

public static void createPath(final ZooKeeperItf zk, final String path)
    throws InterruptedException, KeeperException {
  createPath(zk, path, null);
}

代码示例来源:origin: NGDATA/hbase-indexer

public IndexerProcessRegistryImpl(ZooKeeperItf zk, Configuration conf) throws InterruptedException, KeeperException {
  this.zk = zk;
  this.zkBaseNode = conf.get(ConfKeys.ZK_ROOT_NODE) + "/indexerprocess";
  ZkUtil.createPath(zk, zkBaseNode);
}

代码示例来源:origin: com.ngdata/hbase-indexer-model

public IndexerProcessRegistryImpl(ZooKeeperItf zk, Configuration conf) throws InterruptedException, KeeperException {
  this.zk = zk;
  this.zkBaseNode = conf.get(ConfKeys.ZK_ROOT_NODE) + "/indexerprocess";
  ZkUtil.createPath(zk, zkBaseNode);
}

代码示例来源:origin: NGDATA/hbase-indexer

public IndexerModelImpl(ZooKeeperItf zk, String zkRoot) throws InterruptedException, KeeperException {
  this.zk = zk;
  this.indexerCollectionPath = zkRoot + "/indexer";
  this.indexerCollectionPathSlash = indexerCollectionPath + "/";
  this.indexerTrashPath = zkRoot + "/indexer-trash";
  ZkUtil.createPath(zk, indexerCollectionPath);
  ZkUtil.createPath(zk, indexerTrashPath);
  zk.addDefaultWatcher(connectStateWatcher);
  indexerCacheRefresher.start();
  indexerCacheRefresher.waitUntilStarted();
}

代码示例来源:origin: com.ngdata/hbase-indexer-model

public IndexerModelImpl(ZooKeeperItf zk, String zkRoot) throws InterruptedException, KeeperException {
  this.zk = zk;
  this.indexerCollectionPath = zkRoot + "/indexer";
  this.indexerCollectionPathSlash = indexerCollectionPath + "/";
  this.indexerTrashPath = zkRoot + "/indexer-trash";
  ZkUtil.createPath(zk, indexerCollectionPath);
  ZkUtil.createPath(zk, indexerTrashPath);
  zk.addDefaultWatcher(connectStateWatcher);
  indexerCacheRefresher.start();
  indexerCacheRefresher.waitUntilStarted();
}

代码示例来源:origin: NGDATA/hbase-indexer

private JettySolrRunner createServer() throws Exception {
  // create path on zookeeper for solr cloud
  ZooKeeperItf zk = ZkUtil.connect("localhost:" + zkClientPort, 10000);
  ZkUtil.createPath(zk, "/solr");
  zk.close();
  return new JettySolrRunner(solrHomeDir.toString(), "/solr", solrPort);
}

代码示例来源:origin: com.ngdata/hbase-indexer-common

private JettySolrRunner createServer() throws Exception {
  // create path on zookeeper for solr cloud
  ZooKeeperItf zk = ZkUtil.connect("localhost:" + zkClientPort, 10000);
  ZkUtil.createPath(zk, "/solr");
  zk.close();
  return new JettySolrRunner(solrHomeDir.toString(), "/solr", solrPort);
}

代码示例来源:origin: NGDATA/hbase-indexer

ZkUtil.createPath(zk, basePath + "/hbaseid", Bytes.toBytes(uuid.toString()));
ZkUtil.createPath(zk, basePath + "/rs");

代码示例来源:origin: com.ngdata/hbase-sep-impl-common

ZkUtil.createPath(zk, basePath + "/hbaseid", Bytes.toBytes(uuid.toString()));
ZkUtil.createPath(zk, basePath + "/rs");

代码示例来源:origin: NGDATA/hbase-indexer

private void proposeAsLeader() throws LeaderElectionSetupException, InterruptedException, KeeperException {
  ZkUtil.createPath(zk, electionPath);
  try {
    // In case of connection loss, a node might have been created for us (we do not know it). Therefore,
    // retrying upon connection loss is important, so that we can continue with watching the leaders.
    // Later on, we do not look at the name of the node we created here, but at the owner.
    zk.retryOperation(new ZooKeeperOperation<String>() {
      @Override
      public String execute() throws KeeperException, InterruptedException {
        return zk.create(electionPath + "/n_", null, ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.EPHEMERAL_SEQUENTIAL);
      }
    });
  } catch (KeeperException e) {
    throw new LeaderElectionSetupException("Error creating leader election zookeeper node below " +
        electionPath, e);
  }
  watchLeaders();
}

代码示例来源:origin: com.ngdata/hbase-indexer-common

private void proposeAsLeader() throws LeaderElectionSetupException, InterruptedException, KeeperException {
  ZkUtil.createPath(zk, electionPath);
  try {
    // In case of connection loss, a node might have been created for us (we do not know it). Therefore,
    // retrying upon connection loss is important, so that we can continue with watching the leaders.
    // Later on, we do not look at the name of the node we created here, but at the owner.
    zk.retryOperation(new ZooKeeperOperation<String>() {
      @Override
      public String execute() throws KeeperException, InterruptedException {
        return zk.create(electionPath + "/n_", null, CreateMode.EPHEMERAL_SEQUENTIAL);
      }
    });
  } catch (KeeperException e) {
    throw new LeaderElectionSetupException("Error creating leader election zookeeper node below " +
        electionPath, e);
  }
  watchLeaders();
}

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