Return-Path: Delivered-To: apmail-zookeeper-user-archive@www.apache.org Received: (qmail 68806 invoked from network); 25 Mar 2011 15:56:51 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 25 Mar 2011 15:56:51 -0000 Received: (qmail 46916 invoked by uid 500); 25 Mar 2011 15:56:50 -0000 Delivered-To: apmail-zookeeper-user-archive@zookeeper.apache.org Received: (qmail 46870 invoked by uid 500); 25 Mar 2011 15:56:50 -0000 Mailing-List: contact user-help@zookeeper.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@zookeeper.apache.org Delivered-To: mailing list user@zookeeper.apache.org Received: (qmail 46862 invoked by uid 99); 25 Mar 2011 15:56:50 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 25 Mar 2011 15:56:50 +0000 X-ASF-Spam-Status: No, hits=0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE X-Spam-Check-By: apache.org Received-SPF: unknown (nike.apache.org: error in processing during lookup of strib@nicira.com) Received: from [209.85.220.170] (HELO mail-vx0-f170.google.com) (209.85.220.170) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 25 Mar 2011 15:56:42 +0000 Received: by vxb40 with SMTP id 40so535909vxb.15 for ; Fri, 25 Mar 2011 08:56:21 -0700 (PDT) Received: by 10.220.37.13 with SMTP id v13mr264636vcd.31.1301068580940; Fri, 25 Mar 2011 08:56:20 -0700 (PDT) Received: from [192.168.1.2] (204-195-74-139.wavecable.com [204.195.74.139]) by mx.google.com with ESMTPS id x40sm240045vcr.37.2011.03.25.08.56.18 (version=SSLv3 cipher=OTHER); Fri, 25 Mar 2011 08:56:19 -0700 (PDT) Message-ID: <4D8CBB20.8090205@nicira.com> Date: Fri, 25 Mar 2011 08:56:16 -0700 From: Jeremy Stribling User-Agent: Thunderbird 2.0.0.24 (X11/20100623) MIME-Version: 1.0 To: tyree731@gmail.com CC: user@zookeeper.apache.org Subject: Re: watcher semantics for session events in the C client References: <4D8BD4A1.40507@nicira.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org Stephen Tyree wrote: > Yeah, it's a feature. You can think of those session events as notification > that the watcher will or will not be triggered in a given time period. Given > that watches are not triggered while you are not connected, and won't be > resent when you do become connected, having it so the watcher callbacks > receive session events as well is a way to allow consumers of Zookeeper to > prepare for and recover from situations where watches they expect to fire > might not. Also, if every time the network had a little blip your watchers > were reset that would get annoying quick. Blips in the connection could lead > to stampedes of resetting watches, which would be silly. > Thanks Stephen, that's what I figured was going on, I was just confused by the documentation. > An example of the utility of this was in a notification system I set up. > Essentially, whenever I was notified in a watcher callback that I had just > been reconnected, I would check to see if my watcher should have fired in > the time I was disconnected. If it should have, I performed the notification > and reset the watch, otherwise I continued to wait. > But in either case, it sounds like the semantics are that the watch would still be set because it was never fired. So why do you need to reset the watch in the case that you fire the notification?