From: Flavio J. <fpj...@ya...> - 2008-06-05 09:49:56
|
Avinash, When you create a ZooKeeper object, you have to pass an object that implements the Watcher interface. This interface basically defines a method "process(WatcherEvent)" that your object has to implement. Unless you change it with the method "ZooKeeper.register(Watcher w)", a call back due to a watch event is an invocation to the "process()" method of the initial object. The process() method receives a parameter of type WatcherEvent, which has three fields: type, state, and path. Please take a look at Watcher.java for types and states. I think the path field is obvious. Let me know if you have any trouble figuring this out. Also, I know that there is information missing there, but please consider taking a look at our wiki page: http://zookeeper.wiki.sourceforge.net/ZooKeeperWatches and let us know if you have comments on how to improve it. Thanks, -Flavio ----- Original Message ---- From: Avinash Lakshman <avi...@gm...> To: zoo...@li... Sent: Thursday, June 5, 2008 9:15:54 AM Subject: [Zookeeper-user] Watch event handlers Hi All I am trying to get my feet wet with Zookeeper. I am trying to set up watch events for a call to getChildren() for a particular znode. My question is whether the same watcher that the ZooKeeper instance was constructed with going to be called for all watch events. If so how do I know for what event it is being called. Thanks A |