I believe what the author is trying to say is that if the getdata were to
fail (such as the example you give) the watch set as part of the original
call will fire, and this will notify the client that the node was deleted.
(call to process(event))
On Mon, Sep 27, 2010 at 6:56 PM, Milind Parikh <milindpar...@gmail.com>wrote:
> In the explanation of the Java binding, it is mentioned "If the file (or
> znode) exists, it gets the data from the znode, and then invoke the
> callback of Executor if the state has changed. Note, it doesn't have to do
> any Exception processing for the getData call because it has watches
> for anything that could cause an error: if the node is deleted before it
> calls ZooKeeper.getData(), the watch event set by the
> ZooKeeper.exists()triggers a callback.... "
> I read this to mean that if I insert a Thread.sleep() before the getData
> call & removed the node from the cli, somehow (magically) there would be no
> error. But of course, it does not happen....
> Sleeps for 10 seconds
> org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode =
> NoNode for /zk_test
> at org.apache.zookeeper.KeeperException.create(KeeperException.java:102)
> at org.apache.zookeeper.KeeperException.create(KeeperException.java:42)
> at org.apache.zookeeper.ZooKeeper.getData(ZooKeeper.java:921)
> at org.apache.zookeeper.ZooKeeper.getData(ZooKeeper.java:950)
> at DataMonitor.processResult(DataMonitor.java:114)
> at org.apache.zookeeper.ClientCnxn$EventThread.run(ClientCnxn.java:512)
> Am I doing something wrong (or reading something wrong)?
> -- Milind