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 8663210936 for ; Tue, 12 Nov 2013 15:20:25 +0000 (UTC) Received: (qmail 60862 invoked by uid 500); 12 Nov 2013 15:20:25 -0000 Delivered-To: apmail-curator-user-archive@curator.apache.org Received: (qmail 60828 invoked by uid 500); 12 Nov 2013 15:20:24 -0000 Mailing-List: contact user-help@curator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@curator.apache.org Delivered-To: mailing list user@curator.apache.org Received: (qmail 60820 invoked by uid 99); 12 Nov 2013 15:20:24 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 12 Nov 2013 15:20:24 +0000 X-ASF-Spam-Status: No, hits=2.2 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy includes SPF record at spf.trusted-forwarder.org) Received: from [209.85.192.169] (HELO mail-pd0-f169.google.com) (209.85.192.169) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 12 Nov 2013 15:20:16 +0000 Received: by mail-pd0-f169.google.com with SMTP id y13so4200904pdi.28 for ; Tue, 12 Nov 2013 07:19:53 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:content-type:message-id:mime-version :subject:date:references:to:in-reply-to; bh=bM/AFQkadMn7gEVVavuAfEfnzgH2t8ynqbXFRnOB24s=; b=dmDnqkw2TEXM/QgVNAlIaJLAAI0WqVNDiENeYJotnAMvWAipzYMJy+bdC8mLrPBXq1 yfZt+QVoGlPQ4uynvwh9UTc8DrvbScisRdadH4AckMmlDIBjyRMJxSSMiRQ/3tSHru7Y UCb603VYNXL9VclmRlXwZvRFasTkzP9/AHmaIrQe49h+K2fZPBL8GS2XOtAnURFI2sTM cj3RHGnhbnmh2lGil3IYuJmNg9UN+jpZD5qjCj56AYPv71dXHIys5H54KEepR7naXPzF qP0WpskSGlUxYExXq9VMYcMn+K/VHz7f4aGthE4CPFTcNgsfVkPwLVF2e/NBbMy+dE75 VIRQ== X-Gm-Message-State: ALoCoQlWwmYCP8Vj82c9JlJqwbiUkaVNCTkxyakyRuSflab7Sbcf2qJ6f+/x4WmjN74CTruC36tw X-Received: by 10.66.129.141 with SMTP id nw13mr3761568pab.167.1384269593739; Tue, 12 Nov 2013 07:19:53 -0800 (PST) Received: from [10.0.0.9] (c-50-168-88-247.hsd1.ca.comcast.net. [50.168.88.247]) by mx.google.com with ESMTPSA id x8sm38179031pbf.0.2013.11.12.07.19.52 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 12 Nov 2013 07:19:52 -0800 (PST) From: Jordan Zimmerman Content-Type: multipart/alternative; boundary="Apple-Mail=_0146E49A-A454-4C13-B788-39CE142C38AA" Message-Id: Mime-Version: 1.0 (Mac OS X Mail 7.0 \(1822\)) Subject: Re: When is notLeader of LeaderLatchListener is called? Date: Tue, 12 Nov 2013 07:19:50 -0800 References: To: user@curator.apache.org In-Reply-To: X-Mailer: Apple Mail (2.1822) X-Virus-Checked: Checked by ClamAV on apache.org --Apple-Mail=_0146E49A-A454-4C13-B788-39CE142C38AA Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=iso-8859-1 When LeaderLatch.close() is called, all listeners are cleared. You are = closing/destroying the instance that was created. Listeners set in the = LeaderLatch are not called once close() has been called. Have a look at = the LeaderLatch.close() source code to see this. -Jordan On Nov 12, 2013, at 12:24 AM, Bae, Jae Hyeon wrote: > On Tue, Nov 12, 2013 at 12:23 AM, Bae, Jae Hyeon = wrote: > Hello >=20 > When I was testing with LeaderLatch recipe, I created two = LeaderLatches and closed the first one which was the original leader. I = expected notBecome method of listener which was added to the first one, = but it was not because close() method is removing LeaderLatchListener. >=20 > For example, >=20 > LeaderLatchListener listener1 =3D new LeaderLatchListener(...); > LeaderLatch latch1 =3D new LeaderLatch(...); > latch1.addListener(listener1); > latch1.start(); > ... >=20 > LeaderLatchListener listener2 =3D new LeaderLatchListener(...); > LeaderLatch latch2 =3D new LeaderLatch(...); > latch2.addListener(listener1); > latch2.start(); > ... > latch1.close(); > // here I expected listener1.notBecome() method would be called but it = was not. >=20 > When is notLeader method is called? >=20 > Thank you > Best, Jae >=20 >=20 >=20 >=20 --Apple-Mail=_0146E49A-A454-4C13-B788-39CE142C38AA Content-Transfer-Encoding: 7bit Content-Type: text/html; charset=iso-8859-1
When LeaderLatch.close() is called, all listeners are cleared. You are closing/destroying the instance that was created. Listeners set in the LeaderLatch are not called once close() has been called. Have a look at the LeaderLatch.close() source code to see this.

-Jordan

On Nov 12, 2013, at 12:24 AM, Bae, Jae Hyeon <metacret@gmail.com> wrote:

On Tue, Nov 12, 2013 at 12:23 AM, Bae, Jae Hyeon <metacret@gmail.com> wrote:
Hello

When I was testing with LeaderLatch recipe, I created two LeaderLatches and closed the first one which was the original leader. I expected notBecome method of listener which was added to the first one, but it was not because close() method is removing LeaderLatchListener.

For example,

LeaderLatchListener listener1 = new LeaderLatchListener(...);
LeaderLatch latch1 = new LeaderLatch(...);
latch1.addListener(listener1);
latch1.start();
...

LeaderLatchListener listener2 = new LeaderLatchListener(...);
LeaderLatch latch2 = new LeaderLatch(...);
latch2.addListener(listener1);
latch2.start();
...
latch1.close();
// here I expected listener1.notBecome() method would be called but it was not.

When is notLeader method is called?

Thank you
Best, Jae





--Apple-Mail=_0146E49A-A454-4C13-B788-39CE142C38AA--