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 <[email protected]> wrote:

> On Tue, Nov 12, 2013 at 12:23 AM, Bae, Jae Hyeon <[email protected]> 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
> 
> 
> 
> 

Reply via email to