Watches are not considered triggered when the watch handlers get called with EventType.None, They are merely being notified that the client got disconnected from ZooKeeper and they won't receive any watch events until the session gets re-established. When the client gets reconnected to ZooKeeper, it might find out that the session has been expired. In that case, all the watches associated with that sessions are lost.
This page explains why ZooKeeper notifies watches about session events. http://zookeeper.apache.org/doc/r3.2.2/zookeeperProgrammers.html#ch_zkWatches {quote} When you disconnect from a server (for example, when the server fails), you will not get any watches until the connection is reestablished. For this reason session events are sent to all outstanding watch handlers. Use session events to go into a safe mode: you will not be receiving events while disconnected, so your process should act conservatively in that mode. {quote} --Michi On Tue, Jun 5, 2012 at 7:56 PM, iamct <[email protected]> wrote: > Thank you! > but i thank it/s not my answer。 > My questiong is:using java api,I set a watch > ( methed:getData(final String path, Watcher watcher, Stat stat) ) > > I know the watch can be triggered when NodeDataChanged and NodeDeleted (the > api tell me only the two EventType )。 > > but I found the watch was triggered by EventType.NOne when i try testing to > expired a session。 > > (https://cwiki.apache.org/confluence/display/ZOOKEEPER/FAQ > Is there an easy way to expire a session for testing?) > > -- > View this message in context: > http://zookeeper-user.578899.n2.nabble.com/when-the-zookeeper-Expired-may-I-have-to-rebuild-the-watch-on-a-znode-tp7577513p7577535.html > Sent from the zookeeper-user mailing list archive at Nabble.com.
