Hi Vinod, I think what Ben meant was this-- The client will never know of a session expiration until and unless its connected to one of the servers. So the leader cannot demote itself since its connected to one of the servers. It might have lost its session (which all the others except itself would have realized) but will have to wait to demote itself until it connects to one of the servers.
mahadev On 1/7/09 10:02 AM, "Vinod Johnson" <thomas.john...@sun.com> wrote: > Benjamin Reed wrote: >> You don't demote yourself on disconnect. (Everyone else may still believe you >> are the leader.) Check out the "Things to Remember about Watches" section in >> the programmer's guide. >> >> When you are disconnected from ZK you don't know what is happening, so you >> have to act conservatively. Your session may or may not have expired. You >> will not know for sure until you reconnect to ZK. >> > Just to make sure I'm not misunderstanding the last bit, even without > reconnecting to ZK, the leader's session could expire at the client > side, correct? In that case the conservative thing for the leader to do > is to demote itself if the intent is to avoid split brain (even though > the session may still be active at ZK for some period of time after this).