本文整理了Java中org.apache.hadoop.hbase.zookeeper.ZKUtil.asyncCreate()
方法的一些代码示例,展示了ZKUtil.asyncCreate()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZKUtil.asyncCreate()
方法的具体详情如下:
包路径:org.apache.hadoop.hbase.zookeeper.ZKUtil
类名称: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
private void createNode(String path, Long retry_count) {
SplitLogTask slt = new SplitLogTask.Unassigned(details.getServerName());
ZKUtil.asyncCreate(this.watcher, path, slt.toByteArray(), new CreateAsyncCallback(),
retry_count);
SplitLogCounters.tot_mgr_node_create_queued.increment();
return;
}
代码示例来源:origin: co.cask.hbase/hbase
private void createNode(String path, Long retry_count) {
ZKUtil.asyncCreate(this.watcher, path,
TaskState.TASK_UNASSIGNED.get(serverName), new CreateAsyncCallback(),
retry_count);
tot_mgr_node_create_queued.incrementAndGet();
return;
}
代码示例来源:origin: harbby/presto-connectors
private void createNode(String path, Long retry_count) {
SplitLogTask slt = new SplitLogTask.Unassigned(details.getServerName(), getRecoveryMode());
ZKUtil.asyncCreate(this.watcher, path, slt.toByteArray(), new CreateAsyncCallback(),
retry_count);
SplitLogCounters.tot_mgr_node_create_queued.incrementAndGet();
return;
}
代码示例来源:origin: co.cask.hbase/hbase
/**
* Creates an unassigned node in the OFFLINE state for the specified region.
* <p>
* Runs asynchronously. Depends on no pre-existing znode.
*
* <p>Sets a watcher on the unassigned region node.
*
* @param zkw zk reference
* @param region region to be created as offline
* @param serverName server event originates from
* @param cb
* @param ctx
* @throws KeeperException if unexpected zookeeper exception
* @throws KeeperException.NodeExistsException if node already exists
*/
public static void asyncCreateNodeOffline(ZooKeeperWatcher zkw,
HRegionInfo region, ServerName serverName,
final AsyncCallback.StringCallback cb, final Object ctx)
throws KeeperException {
LOG.debug(zkw.prefix("Async create of unassigned node for " +
region.getEncodedName() + " with OFFLINE state"));
RegionTransitionData data = new RegionTransitionData(
EventType.M_ZK_REGION_OFFLINE, region.getRegionName(), serverName);
String node = getNodeName(zkw, region.getEncodedName());
ZKUtil.asyncCreate(zkw, node, data.getBytes(), cb, ctx);
}
代码示例来源:origin: harbby/presto-connectors
/**
* Creates an unassigned node in the OFFLINE state for the specified region.
* <p>
* Runs asynchronously. Depends on no pre-existing znode.
*
* <p>Sets a watcher on the unassigned region node.
*
* @param zkw zk reference
* @param region region to be created as offline
* @param serverName server transition will happen on
* @param cb
* @param ctx
* @throws KeeperException if unexpected zookeeper exception
* @throws KeeperException.NodeExistsException if node already exists
*/
public static void asyncCreateNodeOffline(ZooKeeperWatcher zkw,
HRegionInfo region, ServerName serverName,
final AsyncCallback.StringCallback cb, final Object ctx)
throws KeeperException {
LOG.debug(zkw.prefix("Async create of unassigned node " +
region.getEncodedName() + " with OFFLINE state"));
RegionTransition rt =
RegionTransition.createRegionTransition(
EventType.M_ZK_REGION_OFFLINE, region.getRegionName(), serverName);
String node = getNodeName(zkw, region.getEncodedName());
ZKUtil.asyncCreate(zkw, node, rt.toByteArray(), cb, ctx);
}
内容来源于网络,如有侵权,请联系作者删除!