You can just set a getData or exists watch on the node you are interested in.
>From the documentation at http://zookeeper.apache.org/doc/r3.1.2/zookeeperProgrammers.html: getData() and exists() return information about the data of the node, whereas getChildren() returns a list of children. Thus, setData() will trigger data watches for the znode being set (assuming the set is successful). A successful create() will trigger a data watch for the znode being created and a child watch for the parent znode. A successful delete() will trigger both a data watch and a child watch (since there can be no more children) for a znode being deleted as well as a child watch for the parent znode. On Mon, Jun 9, 2014 at 10:20 AM, xytd <[email protected]> wrote: > > > Is there way to watch for a deletion of a child node? The callback thus > contains the node path which is being deleted. > > The only way I would see it to work is to load a list of the children and > when a ChildrenWatch gets triggered, use it to compare with the list of > children returned. But this is not very intuitive. There must be a better > way to do this? > > Thanks for any suggestion, > > Yang > > > > > -- > View this message in context: > http://zookeeper-user.578899.n2.nabble.com/How-to-set-a-watch-for-a-deletion-of-a-node-tp7579974.html > Sent from the zookeeper-user mailing list archive at Nabble.com.
