zookeeper-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Olivier Van Acker <cyberroa...@gmail.com>
Subject Re: zookeeper leadership election example application
Date Mon, 28 Nov 2011 12:28:12 GMT
Thanks for the suggestions,
I've implemented your first two suggestions, just a couple of questions
about the other ones:

> * All ZooKeeper operations should be in some kind of retry loop. The
> client can lose connection to a given server but successfully reconnect to
> another one in the cluster.
> I thought this retry happend via process(WatchedEvent event) where the
event.getType() == Watcher.Event.EventType.None
event.getState() == SyncConnected
I catch this in NodeMonitor.processNoneEvent() where I try to create the
client znode again on reconnecting

> * When creating the Znode, it can succeed on the server but fail to return
> the result to the client. On a Disconnect/Session exception, you should
> retry and then call getChildren and search for your node.
> I'm creating the Znodes as ephemeral nodes, would a disconnect not result
in the disappearance of the Znode and therefore getChildren would never
contain the client Znode?



> -JZ
> On 11/25/11 2:45 AM, "Olivier Van Acker" <cyberroadie@gmail.com> wrote:
> >I've written a example app on how to do implement leadership election in
> >with zookeeper
> >Is there anyone on the list who'd like to review my app and if it needs
> >improvement or not?
> >
> >the app is on github:
> >https://github.com/cyberroadie/zookeeper-leader
> >
> >and explained how it works on my blog:
> >
> http://cyberroadie.wordpress.com/2011/11/24/implementing-leader-election-w
> >ith-zookeeper/
> >
> >Olivier

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message