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 <[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.

Thanks
A 


      
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Zookeeper-user mailing list
Zookeeper-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/zookeeper-user

Reply via email to