Return-Path: X-Original-To: apmail-curator-dev-archive@minotaur.apache.org Delivered-To: apmail-curator-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 4C90311986 for ; Thu, 9 May 2013 23:50:38 +0000 (UTC) Received: (qmail 16226 invoked by uid 500); 9 May 2013 23:50:38 -0000 Delivered-To: apmail-curator-dev-archive@curator.apache.org Received: (qmail 16196 invoked by uid 500); 9 May 2013 23:50:38 -0000 Mailing-List: contact dev-help@curator.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@curator.incubator.apache.org Delivered-To: mailing list dev@curator.incubator.apache.org Received: (qmail 16188 invoked by uid 99); 9 May 2013 23:50:38 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 09 May 2013 23:50:38 +0000 X-ASF-Spam-Status: No, hits=-2001.2 required=5.0 tests=ALL_TRUSTED,RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO mail.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with SMTP; Thu, 09 May 2013 23:50:35 +0000 Received: (qmail 11467 invoked by uid 99); 9 May 2013 23:50:13 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 09 May 2013 23:50:13 +0000 Date: Thu, 9 May 2013 23:50:13 +0000 (UTC) From: "Jordan Zimmerman (JIRA)" To: dev@curator.incubator.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (CURATOR-22) Add a listener to LeaderLatch MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/CURATOR-22?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Jordan Zimmerman updated CURATOR-22: ------------------------------------ Issue Type: Improvement (was: Bug) > Add a listener to LeaderLatch > ----------------------------- > > Key: CURATOR-22 > URL: https://issues.apache.org/jira/browse/CURATOR-22 > Project: Apache Curator > Issue Type: Improvement > Components: Recipes > Affects Versions: 2.0.0-incubating > Reporter: Eric Tschetter > Assignee: Jordan Zimmerman > Fix For: 2.0.1-incubating > > Attachments: CURATOR-22-2.patch, CURATOR-22.patch > > > From the mailing list: > Hi guys, > I'm looking at using Leader Latch and I noticed it only has polling mechanisms for figuring out if you are the leader. I was wondering if there is a reason to not have a callback mechanism that you can register with two methods: > startBeingMaster(); > stopBeingMaster(); > Basically, any time setLeadership() is called with a value other than what it was, it would cause either startBeingMaster() to be called or stopBeingMaster() to be called. > I can effect this using an extra thread and the polling mechanisms that are there, but am wondering if I'm the only one that would prefer to interact with it in this way or if others would also prefer to have access to this type of API? > (Btw, for anyone wondering, I'm currently swapping out an old zookeeper client library for Curator and that's why I have all of these random questions about APIs and stuff) > Jordan Zimmerman jordan@jordanzimmerman.com via googlegroups.com > 1:48 PM (2 hours ago) > to curator-users > Look at LeaderSelector. It is a leader recipe that has a callback mechanism. > Jordan Zimmerman > Eric Tschetter cheddar@metamarkets.com > 2:27 PM (2 hours ago) > to curator-users > Oh, that's the Leader Election recipe. > I don't really like that abstraction either because it makes me worry about too much: > 1) Losing connection, etc. > 2) "Relinquishing" leadership > I just want to either be the leader or not be the leader and have that choice be completely external. That is, I want something to tell me that I became the leader or that I lost leadership. I assume that I can always give up my leadership by just closing the thing down. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira