I had the exact same questions while reading the programmers guide. The guide should change to answer them more explicitly.
2012/10/13 Rakesh R <[email protected]> > Hi Rohan, > > >>>>>>> 1. If my session has a default watcher w, and I make a call that > sets > another watcher w' for a specific znode, will both w and w' get called if > the znode changes? > > Default watcher w will only carry the zookeeper session states > Disconnected, Expired, SyncConnected, AuthFailed etc events. This Watcher > is notified when any state change occurs in the client for example, when > you successfully establish a connection, this watcher will receive a > SyncConnected event or if the client's session expires will trigger Expired > etc. > > w' is specially meant for watching the znode and here the default watcher > w will not receive notification on znode changes. But he will recieve state > changes as explained below. > > >>>>>>>2. If my session expires, on reconnect willl both w and w' be > notified > of the session expiry or just w? > > Here both w and w' will be notified and sequence will be first disconnect > event, then expiry event. > > > -Rakesh > ________________________________________ > From: Rohan Desai [[email protected]] > Sent: Saturday, October 13, 2012 1:49 AM > To: [email protected] > Subject: Some questions about Watches > > I had a couple questions about ZooKeeper watches that weren't immediately > clear from the programmer's guide > 1. If my session has a default watcher w, and I make a call that sets > another watcher w' for a specific znode, will both w and w' get called if > the znode changes? > 2. If my session expires, on reconnect willl both w and w' be notified > of the session expiry or just w? > -- Sincerely yours, Apostolis Xekoukoulotakis
