gpt4 book ai didi

com.alibaba.wasp.zookeeper.ZooKeeperWatcher.sync()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-13 11:18:55 26 4
gpt4 key购买 nike

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

ZooKeeperWatcher.sync介绍

[英]Forces a synchronization of this ZooKeeper client connection.

Executing this method before running other methods will ensure that the subsequent operations are up-to-date and consistent as of the time that the sync is complete.

This is used for compareAndSwap type operations where we need to read the data of an existing node and delete or transition that node, utilizing the previously read version and data. We want to ensure that the version read is up-to-date from when we begin the operation.
[中]强制同步此ZooKeeper客户端连接。
在运行其他方法之前执行此方法将确保后续操作在同步完成时是最新且一致的。
这用于比较DSWAP类型的操作,我们需要读取现有节点的数据,并使用以前读取的版本和数据删除或转换该节点。我们希望确保从开始操作时读取的版本是最新的。

代码示例

代码示例来源:origin: alibaba/wasp

+ entityGroupName + " that is in expected state " + expectedState));
String node = getNodeName(zkw, entityGroupName);
zkw.sync(node);
Stat stat = new Stat();
byte[] bytes = ZKUtil.getDataNoWatch(zkw, node, stat);

代码示例来源:origin: alibaba/wasp

zkw.sync(node);

代码示例来源:origin: alibaba/wasp

byte[] data = rt.toByteArray();
String node = getNodeName(zkw, entityGroup.getEncodedName());
zkw.sync(node);
int version = ZKUtil.checkExists(zkw, node);
if (version == -1) {

代码示例来源:origin: alibaba/wasp

zkw.sync(node);

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