org.apache.hadoop.hbase.zookeeper.ZKUtil.asyncCreate()方法的使用及代码示例

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

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

ZKUtil.asyncCreate介绍

[英]Async creates the specified node with the specified data.

Throws an exception if the node already exists.

The node created is persistent and open access.
[中]Async使用指定的数据创建指定的节点。
如果节点已存在,则引发异常。
创建的节点是持久的、开放访问的。

代码示例

代码示例来源:origin: apache/hbase

  1. private void createNode(String path, Long retry_count) {
  2. SplitLogTask slt = new SplitLogTask.Unassigned(details.getServerName());
  3. ZKUtil.asyncCreate(this.watcher, path, slt.toByteArray(), new CreateAsyncCallback(),
  4. retry_count);
  5. SplitLogCounters.tot_mgr_node_create_queued.increment();
  6. return;
  7. }

代码示例来源:origin: co.cask.hbase/hbase

  1. private void createNode(String path, Long retry_count) {
  2. ZKUtil.asyncCreate(this.watcher, path,
  3. TaskState.TASK_UNASSIGNED.get(serverName), new CreateAsyncCallback(),
  4. retry_count);
  5. tot_mgr_node_create_queued.incrementAndGet();
  6. return;
  7. }

代码示例来源:origin: harbby/presto-connectors

  1. private void createNode(String path, Long retry_count) {
  2. SplitLogTask slt = new SplitLogTask.Unassigned(details.getServerName(), getRecoveryMode());
  3. ZKUtil.asyncCreate(this.watcher, path, slt.toByteArray(), new CreateAsyncCallback(),
  4. retry_count);
  5. SplitLogCounters.tot_mgr_node_create_queued.incrementAndGet();
  6. return;
  7. }

代码示例来源:origin: co.cask.hbase/hbase

  1. /**
  2. * Creates an unassigned node in the OFFLINE state for the specified region.
  3. * <p>
  4. * Runs asynchronously. Depends on no pre-existing znode.
  5. *
  6. * <p>Sets a watcher on the unassigned region node.
  7. *
  8. * @param zkw zk reference
  9. * @param region region to be created as offline
  10. * @param serverName server event originates from
  11. * @param cb
  12. * @param ctx
  13. * @throws KeeperException if unexpected zookeeper exception
  14. * @throws KeeperException.NodeExistsException if node already exists
  15. */
  16. public static void asyncCreateNodeOffline(ZooKeeperWatcher zkw,
  17. HRegionInfo region, ServerName serverName,
  18. final AsyncCallback.StringCallback cb, final Object ctx)
  19. throws KeeperException {
  20. LOG.debug(zkw.prefix("Async create of unassigned node for " +
  21. region.getEncodedName() + " with OFFLINE state"));
  22. RegionTransitionData data = new RegionTransitionData(
  23. EventType.M_ZK_REGION_OFFLINE, region.getRegionName(), serverName);
  24. String node = getNodeName(zkw, region.getEncodedName());
  25. ZKUtil.asyncCreate(zkw, node, data.getBytes(), cb, ctx);
  26. }

代码示例来源:origin: harbby/presto-connectors

  1. /**
  2. * Creates an unassigned node in the OFFLINE state for the specified region.
  3. * <p>
  4. * Runs asynchronously. Depends on no pre-existing znode.
  5. *
  6. * <p>Sets a watcher on the unassigned region node.
  7. *
  8. * @param zkw zk reference
  9. * @param region region to be created as offline
  10. * @param serverName server transition will happen on
  11. * @param cb
  12. * @param ctx
  13. * @throws KeeperException if unexpected zookeeper exception
  14. * @throws KeeperException.NodeExistsException if node already exists
  15. */
  16. public static void asyncCreateNodeOffline(ZooKeeperWatcher zkw,
  17. HRegionInfo region, ServerName serverName,
  18. final AsyncCallback.StringCallback cb, final Object ctx)
  19. throws KeeperException {
  20. LOG.debug(zkw.prefix("Async create of unassigned node " +
  21. region.getEncodedName() + " with OFFLINE state"));
  22. RegionTransition rt =
  23. RegionTransition.createRegionTransition(
  24. EventType.M_ZK_REGION_OFFLINE, region.getRegionName(), serverName);
  25. String node = getNodeName(zkw, region.getEncodedName());
  26. ZKUtil.asyncCreate(zkw, node, rt.toByteArray(), cb, ctx);
  27. }

相关文章