这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阻塞?),同步读将在监听事件处理之前返回新的值。
太难理解老外说的啥呀!!!