On 11/13/11 3:40 PM, "Jérémie BORDIER" <[email protected]> wrote:
>As noticed in ZOOKEEPER-1209, this can cause really important issues.
>As Leader election is one of the most demanded feature / recipe, I
>would really like to see the official recipe fixed and fully
>functional.
Curator handles this in its API. Our LeaderSelector takes a listener
instance that has two methods:
public void takeLeadership(CuratorFramework client) throws
Exception;
public void notifyClientClosing(CuratorFramework client);
The second method is the important one here. You can think of this like
the JDK's thread interruption mechanism. If a split brain occurs, the
leader connected to the bad half will have its notifyClientClosing method
called.
BTW - all of our recipes have this kind of mechanism.
-JZ