Return-Path: Delivered-To: apmail-hadoop-zookeeper-user-archive@minotaur.apache.org Received: (qmail 47328 invoked from network); 8 May 2009 20:36:50 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 8 May 2009 20:36:50 -0000 Received: (qmail 40761 invoked by uid 500); 8 May 2009 20:36:50 -0000 Delivered-To: apmail-hadoop-zookeeper-user-archive@hadoop.apache.org Received: (qmail 40726 invoked by uid 500); 8 May 2009 20:36:50 -0000 Mailing-List: contact zookeeper-user-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: zookeeper-user@hadoop.apache.org Delivered-To: mailing list zookeeper-user@hadoop.apache.org Received: (qmail 40716 invoked by uid 99); 8 May 2009 20:36:50 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 08 May 2009 20:36:50 +0000 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of ted.dunning@gmail.com designates 74.125.44.30 as permitted sender) Received: from [74.125.44.30] (HELO yx-out-2324.google.com) (74.125.44.30) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 08 May 2009 20:36:40 +0000 Received: by yx-out-2324.google.com with SMTP id 8so942311yxm.29 for ; Fri, 08 May 2009 13:36:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :from:date:message-id:subject:to:content-type; bh=snkucW0mjl8JaPvf6gVymXumleKZG/EfJR1eXhWd7Us=; b=Ow7xcSJ/HKo9VuJuE9CBGf+2C5zGTsagYFhcR0iJUjG+ETvq+wjAoZ6nARvhLTS/Tt sR9qybvsizH8ki+VrPPEq6Q83RWBy+/1QmF4A41YbMInwvjIY8qW+LB1kUYNJTR54anM /6n2HEp3/ZvxhrqH32pmPCqU+xmO1mbn/zBfo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; b=XAI6riBs9nuxkIXDAY94oYyUw/9aTaByBMSu5kCBK+C4kUTuKWcTqRfNtuFjEgACmF UcTORVKJKNWG+zpFY9k34lDIvGZkh/oN01I3GyH8xC/EU9T0JLNVF5463dx7aCG1/jmD 4IOuKrCEw/TUs7J/dbgrfe81tlLwF0xIHMjSQ= MIME-Version: 1.0 Received: by 10.151.82.5 with SMTP id j5mr604743ybl.297.1241814979439; Fri, 08 May 2009 13:36:19 -0700 (PDT) In-Reply-To: <4A0494A7.9040307@apache.org> References: <4A048F93.1000309@yahoo-inc.com> <4A0494A7.9040307@apache.org> From: Ted Dunning Date: Fri, 8 May 2009 13:35:59 -0700 Message-ID: Subject: Re: NodeChildrenChanged WatchedEvent To: zookeeper-user@hadoop.apache.org Content-Type: multipart/alternative; boundary=000e0cd48310b9fe8104696c9499 X-Virus-Checked: Checked by ClamAV on apache.org --000e0cd48310b9fe8104696c9499 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit 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 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. > > --000e0cd48310b9fe8104696c9499--