这zookeeper文档这段说的啥意思?

皇家肆掠者 2017-09-22 11:37:30
https://zookeeper.apache.org/doc/r3.4.6/zookeeperProgrammers.html

Synchronous calls may not return in the correct order. For example, assume a client does the following processing: issues an asynchronous read of node/awithwatchset to true, and then in the completion callback of the read it does a synchronous read of/a. (Maybe not good practice, but not illegal either, and it makes for a simple example.)
Note that if there is a change to/abetween the asynchronous read and the synchronous read, the client library will receive the watch event saying/achanged before the response for the synchronous read, but because the completion callback is blocking the event queue, the synchronous read will return with the new value of/abefore the watch event is processed.

说的似乎是同步多个调用可能不会返回正确的顺序。然后就假设了,一个客户端做以下处理:发出一个异步的读节点/a、然后这里就坑爹了,似乎单词没空格了。意思是用监听来异步读,接下来设置成true?是不是指的监听节点/a,然后发现变化了就设置/a为true。那么完成读的回调里边是一个同步的读/a。

提示如果在异步读和同步读之间/a有变化,这个什么意思? 上段不是说同步读是在异步的回调里吗,指的是回调里边正在同步读的时候又发生了变化。客户端库将会在同步读之前,先收到监听事件saying /a。但是因为回调完成被事件队列阻塞,(是不是被saying /a阻塞?),同步读将在监听事件处理之前返回新的值。

太难理解老外说的啥呀!!!
...全文
163 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

81,092

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧