Hi Steve,
While it would be theoretically possible to add the name of the node
that triggered the event to the watcher notification, the problem is
that this may cause you to "miss" events you wanted to see.
ZK does not guarantee you will get an event for "every" change. Any
changes that occur between the time you get a notification and do a
getChildren requesting a new notification do not send notifications.
That's why when you get the notification, you must call getChildren
and check for ALL changes against your "baseline" since there may be
Obviously with 1m nodes there is a lot of overhead. I would suggest
splitting your list into smaller pieces, say 1000 nodes each, and
setting a watch on each of them. You mentioned using sequential nodes,
which wouldn't work the same way in this case, but either way a
redesign is probably in order.

-Dave Wright

On Mon, Aug 2, 2010 at 10:45 AM, Steve Gury
<steve.g...@mimesis-republic.com> wrote:
> Hi,
> I'm interested in being notified by addition/removal of subnode of a
> watched node.
> The method getChildren allows to be notified when "a successful
> operation that deletes the node of the given path or creates/delete a
> child under the node". But this notification only provides the path of
> the parent, and I would like to have the path of the added/removed
> child.
> For instance:
>   I create a node "BaseNode", and 1 million of EPHEMERAL_SEQUENTIAL
> "ChildNode". I would like to be notified of any new creation/deletion
> of "ChildNode" without having to list all "ChildNode" (1 million!)
>   Ideally, I would like to be notified of any addition/deletion, the
> Watcher being called with a WatchedEvent.getPath returning the path of
> the ChildNode and not the path of the BaseNode.
> Is there any recipe that would provide this feature (or a work around) ?
> Thanks,
> Steve

Reply via email to