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:


and let us know if you have comments on how to improve it.


----- Original Message ----
From: Avinash Lakshman <[EMAIL PROTECTED]>
To: zookeeper-user@lists.sourceforge.net
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.


Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
Zookeeper-user mailing list

Reply via email to