I’d like to see this fixed globally where needed. A suggestion is to add a 
method to the ConnectionState enum something like isConnectedState() so 
RECONNECTED and CONNECTED can return true. Then, throughout Curator it can 
check that value.

-JZ


From: Cameron McKenzie [email protected]
Reply: [email protected] [email protected]
Date: May 28, 2014 at 5:58:09 PM
To: [email protected] [email protected]
Subject:  Leader latch issue?  

Guys,
I'm having a small issue with the LeaderLatch recipe, which I can probably work 
around, but I thought I'd check if it's considered an issue worth fixing.

If we start a LeaderLatch and no connection to ZooKeeper is available, then 
when a connection does become available to ZooKeeper, the latch does not start. 
This is because in the handleStateChange() method, it only resets the latch 
state on RECONNECTED, not on CONNECTED.

So, the latch can recover from connection loss if it's previously had a 
connection, but not if it's never had a connection.

I presume this would simply be a case of changing the handleStateChange() 
method to handle the CONNECTED case as well. I've had a quick look and I don't 
think this would have any side effects.

I'm happy to fix the issue if this is considered a reasonable solution.
cheers
Cam

Reply via email to