curator-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bae, Jae Hyeon" <metac...@gmail.com>
Subject Re: When is notLeader of LeaderLatchListener is called?
Date Tue, 12 Nov 2013 08:24:36 GMT
I forgot to ask this question...

Is notLeader() method designed to be called when the session is closed?


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
>
>
>
>

Mime
View raw message