Re: [Zookeeper-user] Leader election

2008-07-14 Thread Benjamin Reed
The easiest way to fix this code is to move the Collections.sort(values) to right after the zk.getChildren() and then use the following Comparator with Collections.sort() and Collections.binarySearch(): /* This Comparator defines an ordering such that the strings with * the lowest sequence

Re: [Zookeeper-user] Leader election

2008-07-12 Thread Patrick Hunt
PROTECTED] *Subject:* Re: [Zookeeper-user] Leader election Hi Avinash, getChildren returns a list in lexicographic order, so if you are updating the children of the election node concurrently, then you may get a different first node with different clients. If you are using the sequence flag

Re: [Zookeeper-user] Leader election

2008-07-11 Thread Flavio Junqueira
of the node name and using the sufix value to determine order. Hope it helps. -Flavio - Original Message From: Avinash Lakshman [EMAIL PROTECTED] To: zookeeper-user@lists.sourceforge.net Sent: Friday, July 11, 2008 7:20:06 AM Subject: [Zookeeper-user] Leader election Hi I am trying

Re: [Zookeeper-user] Leader Election

2008-06-17 Thread Benjamin Reed
Good point. The recipe we show guarantees there will be a single leader elected, but only the leader knows it. Jacob Levy has been implementing a client library to do leader election, so he should really chime in here, but just in case he doesn't: I believe Jacob's solution was for the leader

Re: [Zookeeper-user] Leader Election

2008-06-17 Thread Jacob Levy
: [Zookeeper-user] Leader Election Good point. The recipe we show guarantees there will be a single leader elected, but only the leader knows it. Jacob Levy has been implementing a client library to do leader election, so he should really chime in here, but just in case he doesn't: I believe