On 05/27/2010 06:54 AM, Dave Wright wrote:
The documentation is inconsistent on what happens to watches after a
disconnection.

The web documentation states:
"Watches will not be received while disconnected from a server. When a
client reconnects, any previously registered watches will be
reregistered and triggered if needed. In general this all occurs
transparently."

However the C API Doxygen documentation states:

" .... If the client is ever disconnected from the service, even if the
   disconnection is temporary, the watches of the client will be removed from
   the service, so a client must treat a disconnect notification as an implicit
   trigger of all outstanding watches."


Hi Dave,

The c api docs are incorrect - prior to v3 of ZK this is the way that watches operated, however in v3 we updated watches code to re-register automatically (under the covers in the zk library). Please enter a jira on this:
https://issues.apache.org/jira/browse/ZOOKEEPER

Which is correct? Looking at the C code, it appears that
"send_set_watches" is called after connection, apparently re-setting
any watches that were requested. It's not clear of those watches will
be automatically triggered if the watched data has changed.

Although not explicitly stated, I'm assuming that in case of an actual
session loss, all watches are lost and need to be re-created.

Correct, if you create a new session (original session closed or invalid) you need to register watches anew.

Patrick

Reply via email to