Clarification on async calls in a cluster

2010-08-11 Thread Jordan Zimmerman
If I use an async version of a call in a cluster (ensemble) what happens if 
the server I'm connected to goes down? Does ZK transparently resubmit the call 
to the next server in the cluster and call my async callback or is there 
something I need to do? The docs aren't clear on this and searching the archive 
didn't give me the answer. Another source of confusion here is that the 
non-async versions do not resubmit the call - I need to do that manually.

Thanks!

Re: Clarification on async calls in a cluster

2010-08-11 Thread Patrick Hunt


On 08/11/2010 03:25 PM, Jordan Zimmerman wrote:

If I use an async version of a call in a cluster (ensemble) what
happens if the server I'm connected to goes down? Does ZK
transparently resubmit the call to the next server in the cluster and
call my async callback or is there something I need to do? The docs
aren't clear on this and searching the archive didn't give me the
answer. Another source of confusion here is that the non-async
versions do not resubmit the call - I need to do that manually.

Thanks!


Hi Jordan, the callbacks have a rc parameter that details the result 
of the request (result code), this will be one of KeeperException.Code, 
in this case CONNECTIONLOSS. You receive a connection loss result when 
the client has sent a request to the server but loses the connection 
before the server responds. You must resubmit of this request manually 
(usually once you reconnect to the cluster), same as for sync calls.


See these sections in the faq:
http://wiki.apache.org/hadoop/ZooKeeper/FAQ#A2

also some detail in
http://hadoop.apache.org/zookeeper/docs/current/zookeeperProgrammers.html#ch_zkSessions

I agree the docs could be improved here. The java api for callback is 
esp. embarassing (there is none). Please enter JIRAs for any areas you'd 
like to see improved, including adding javadoc to the callbacks.


Regards,

Patrick