Hi all,

I'm new to ZooKeeper and i have to implement Leader Election using it.
I've read lots of information about, and i'm following the pseudo-code
available at
http://hadoop.apache.org/zookeeper/docs/r3.0.0/recipes.html#sc_leaderElection

I'll describe my problem:
When i create a znode in client one using the following code, everything
works fine and a "/election/n_0000000000" znode is created. I can tell that,
because of the output of "path".

        String path = "/election/n_";
>         path = zk.create(path, new byte[0], Ids.OPEN_ACL_UNSAFE,
>                 CreateMode.EPHEMERAL_SEQUENTIAL);
>         System.out.println(path);
>

But, when i use the same code in client two, the output is simply
"/election/n_".
I think it should be something like "/election/n_0000000001", so then i can
compare znodes to tell who's the leader.
Is there something wrong about what i'm doing?

Thank you.

Reply via email to