curator-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Giridhar Addepalli <>
Subject Setting watch on node only if number of children is greater than zero
Date Wed, 05 Mar 2014 05:01:09 GMT
Hi All,

I am new to zookeeper/ curator.

I want to setup watch on node if number of children is greater than zero.

I can check number of children before setting the watch.
But there could be a race condition in which , number of children of the
node went to zero before setting up the watch and after checking for number
of children.
And this could lead to deadlock, because i will be listening for child
removal event and there will be none.

One way i could think of solving is polling for number of children in
separate thread.
But is there any cleaner approach via which i can avoid polling ?


View raw message