is_unrecoverable() means exactly that: the session is toast. nothing you
do will get it back.
zookeeper_init is almost never used with a non-null client_id. the main
use case for it is crash recovery. i've rarely seen it used, but you can
start a session, save off the client_id to disk, create ephemerals etc.,
then if your program crashes, you can restart and recover the session
and pick back up where you left off. in this case we don't worry about
the session being closed by the previous instance of the program because
it crashed. it's pretty tricky to use.
On 11/18/2010 04:12 PM, Gustavo Niemeyer wrote:
why don't you let the client library do the move for you?
Maybe there's no need to reestablish the session manually, but there
are a few details in the API which give a hint this should be
supported. The strongest one is that there's a parameter in
zookeeper_init() to allow reestablishing an existing session. Without
the ability to close a previous connection reliably without killing
the existing session, how can we use this parameter and the function
to retrieve the existing client id? Another hint is in
is_unrecoverable(), which says the application must close the zhandle
and try to reconnect in case it returns true. Maybe I misinterpreted
it, and it actually means the *session* is dead, rather than just the