Return-Path: X-Original-To: apmail-zookeeper-user-archive@www.apache.org Delivered-To: apmail-zookeeper-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 67C1872FB for ; Mon, 15 Aug 2011 22:42:39 +0000 (UTC) Received: (qmail 95995 invoked by uid 500); 15 Aug 2011 22:42:38 -0000 Delivered-To: apmail-zookeeper-user-archive@zookeeper.apache.org Received: (qmail 95937 invoked by uid 500); 15 Aug 2011 22:42:38 -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 95929 invoked by uid 99); 15 Aug 2011 22:42:38 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 15 Aug 2011 22:42:38 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of ted.dunning@gmail.com designates 209.85.216.42 as permitted sender) Received: from [209.85.216.42] (HELO mail-qw0-f42.google.com) (209.85.216.42) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 15 Aug 2011 22:42:32 +0000 Received: by qwi4 with SMTP id 4so2759645qwi.15 for ; Mon, 15 Aug 2011 15:42:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=YzDm5xve1RMdFiq/F/65zqFyJdFGy4DlIezQRmQqXII=; b=YdMgCA5sBMLdHiSzKv5Iv/ZM3Nd8pQzATK9Q/I9+yZM++X1Ddt7+u9fceq9J5Kv7y/ F8j+mfgYfd8fauJtbsxPaEJtz6S/ifunT77wPi2OTRcRHUC3MjDrhfCzopbxEIdZZJCG 5QJ7c1yDc2t6OwWTtFhOysReaVvy3JivGKs90= Received: by 10.224.185.201 with SMTP id cp9mr3038520qab.125.1313448132073; Mon, 15 Aug 2011 15:42:12 -0700 (PDT) MIME-Version: 1.0 Received: by 10.224.73.135 with HTTP; Mon, 15 Aug 2011 15:41:52 -0700 (PDT) In-Reply-To: References: <9694A6C3D68A4249BD9E1A875B6BA81E0349CF518F@bos0ex01.corp.attivio.com> From: Ted Dunning Date: Mon, 15 Aug 2011 15:41:52 -0700 Message-ID: Subject: Re: thread pool executor for event dispatch To: user@zookeeper.apache.org Content-Type: multipart/alternative; boundary=485b397dcd9957d95b04aa92f9ce --485b397dcd9957d95b04aa92f9ce Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable And to add to this, the ordering guarantees that ZK provides are perhaps th= e most important of all. They are what allows proper reasoning. The application can always push work into an execution pool from the actual watcher if threaded response makes sense. That avoids blocking the notification thread and allows whatever level of concurrency is appropriate= . On Mon, Aug 15, 2011 at 3:38 PM, Mahadev Konar wro= te: > Martin, > The problem with using a thread pool is that it becomes difficult to mak= e > sense about order of events that occur in the system. > > Here is the snippet from ZK wiki on client guarantees: > > What ZooKeeper Guarantees about Watches > With regard to watches, ZooKeeper maintains these guarantees: > > =E2=80=A2 Watches are ordered with respect to other events, other = watches, > and asynchronous replies. The ZooKeeper client libraries ensures that > everything is dispatched in order. > =E2=80=A2 A client will see a watch event for a znode it is watchi= ng before > seeing the new data that corresponds to that znode. > =E2=80=A2 The order of watch events from ZooKeeper corresponds to = the order > of the updates as seen by the ZooKeeper service. > > > hope that helps > mahadev > > On Aug 15, 2011, at 2:15 PM, Martin Serrano wrote: > > > Hi, > > > > Has the zookeeper community considered adding an option to use a thread > pool executor for event dispatch? One pattern we have developed for our > library is to trigger event listeners in a separate thread to guard again= st > blocking operations in listeners. A blocking watcher will prevent new > events/watchers from being triggered. By adding the ability to configure > which Executor was used by a zookeeper client for event delivery library > writers could make the choice that is best for them. Being able to do th= is > at the client level (rather than for each individual watcher class I > implement) is a cleaner approach IMO. > > > > Thoughts? > > > > -Martin > > --485b397dcd9957d95b04aa92f9ce--