hadoop-zookeeper-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ted Dunning <ted.dunn...@gmail.com>
Subject Re: NodeChildrenChanged WatchedEvent
Date Fri, 08 May 2009 20:35:59 GMT
Also note that you are guaranteed to at some event it the file you are
watching changes, but you may get one notification for several changes.

The general pattern of your code should be:

     getChildren, set watch
     process initial set of children

     ...

     receive notification of change
     getChildren, set watch again
     process changes
     ...

     receive notification of change
     getChildren, set watch again
     process changes

As Ben pointed out, you need to check for all changes each time you receive
a notification because multiple changes may have happened by the time you
receive a notice.  You also need to reset the in the call to getChildren,
not after you have processed the data.

On Fri, May 8, 2009 at 1:23 PM, Patrick Hunt <phunt@apache.org> wrote:

> Javier, also note that the subsequent getChildren you mention in your
> original email is usually not entirely superfluous given that you generally
> want to watch the parent node for further changes, and a getChildren is
> required to set that watch.
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message