Return-Path: X-Original-To: apmail-curator-user-archive@minotaur.apache.org Delivered-To: apmail-curator-user-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 5B753100D6 for ; Wed, 28 Aug 2013 16:33:23 +0000 (UTC) Received: (qmail 81311 invoked by uid 500); 28 Aug 2013 16:33:23 -0000 Delivered-To: apmail-curator-user-archive@curator.apache.org Received: (qmail 81246 invoked by uid 500); 28 Aug 2013 16:33:20 -0000 Mailing-List: contact user-help@curator.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@curator.incubator.apache.org Delivered-To: mailing list user@curator.incubator.apache.org Received: (qmail 81238 invoked by uid 99); 28 Aug 2013 16:33:18 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 28 Aug 2013 16:33:18 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW X-Spam-Check-By: apache.org Received-SPF: error (nike.apache.org: local policy) Received: from [209.85.216.52] (HELO mail-qa0-f52.google.com) (209.85.216.52) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 28 Aug 2013 16:33:10 +0000 Received: by mail-qa0-f52.google.com with SMTP id ii20so549130qab.11 for ; Wed, 28 Aug 2013 09:32:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-gm-message-state:content-type:mime-version:subject:from :in-reply-to:date:content-transfer-encoding:message-id:references:to; bh=oS4b4597ja+iMlkUvvxMnhcN8BzaCgZbq2yd1EBPwjg=; b=BvS9jRsGMEXWhVsfM69tUZgWE2okgmGpTDomrRmI+TZo0ERWUe63OHHOQtS55S5GxX gb4dPd2CwhnZms0oXss0ygaN42kwvqV2+JhE/PPebsSi9NQ/OW4YAJvoGIH0BQW2uF+Q BmvcJlQ20gJRgdqj2jTTw+OIAJH4IFiTIHn1rw7RjZB4xb79JcDMUaPKXvmlePzs2SoG pgrGu7qxUmdbwc9AxJKEi6cfnpPR/98B/ZD4v3wghcRSna79zsuvabXNvs4oFO4cjwGU mZlMbLea0tpLwxSk7QnkbdXdOn42lfLZG7OFZfumZt3zH0/pfxG0MqWXlpPdjOVLePbt 1AqQ== X-Gm-Message-State: ALoCoQlUmvCygJQzMltLZBgQWY/y2Pi+YqA7cSKRxVKwSGkNYztBlhkJIAnthoXtqpL5mIF4rx9e X-Received: by 10.49.59.44 with SMTP id w12mr30764949qeq.57.1377707549408; Wed, 28 Aug 2013 09:32:29 -0700 (PDT) Received: from jzimm1ml1.riotgames.com ([209.133.52.233]) by mx.google.com with ESMTPSA id w8sm36144768qej.3.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 28 Aug 2013 09:32:28 -0700 (PDT) Content-Type: text/plain; charset=iso-8859-1 Mime-Version: 1.0 (Mac OS X Mail 6.5 \(1508\)) Subject: Re: LeaderSelector Executor From: Jordan Zimmerman In-Reply-To: Date: Wed, 28 Aug 2013 09:32:29 -0700 Content-Transfer-Encoding: quoted-printable Message-Id: <04EDE5F0-880B-41A9-A0AE-A9182A794B6E@jordanzimmerman.com> References: To: user@curator.incubator.apache.org X-Mailer: Apple Mail (2.1508) X-Virus-Checked: Checked by ClamAV on apache.org This looks very broken to me. Please open an issue for this. -Jordan On Aug 28, 2013, at 7:44 AM, Henrik Nordvik wrote: > Hi, >=20 > The LeaderSelector has a constructor which takes in ThreadFactory and = Executor as parameters. The "default" constructor uses = MoreExecutors.sameThreadExecutor(). > I tried using my own ThreadPool with multiple threads, because I = thought that was they way of using multiple leaders.=20 > When I did that, to my surprise, it started multiple leaders per path. = After reading the code it makes sense, it only guarantees that you are = the leader when submitting the thread to the executor. >=20 > It seems to me like using anything other than sameThreadExecutor makes = little sense. > When would you want to use it? >=20 >=20 > Example snippet: > LeaderSelectorListener listener =3D new = MyLeaderSelectorListener("1"); > ExecutorService executorPool =3D Executors.newFixedThreadPool(20); > LeaderSelector leaderSelector =3D new LeaderSelector(client, path, = threadFactory, executorPool, listener); > leaderSelector.autoRequeue(); > leaderSelector.start(); > // MyLeaderSelectorListener.takeLeadership is called multiple = times here, even though it is in a sleep-loop. >=20 >=20 > -- > Henrik Nordvik