[ https://issues.apache.org/jira/browse/ZOOKEEPER-779?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12870545#action_12870545 ]
Qian Ye commented on ZOOKEEPER-779: ----------------------------------- By "check connectivity", I mean check whether client can connect to a zookeeper server which is listed in the parameters. In my usage, zookeeper is used to store some meta infomation. The logic flow of my app is that if it can connect to the zookeeper, then obtain the meta info from zookeeper, or obtain it from local file. Becuase the connection to the zookeeper server is not initialized when the zookeeper_init return (mt version), I used to make my app sleep a few seconds to make sure the connection is initialized, however, if the hosts list contains some invalid servers address, the sleep time is hard to estimate. I cannot take the initialization method used in load_gen.c, because in some situation, I want my app read meta info from local file by give a wrong host to zookeepr_init. In a word, I just want zookeeper_init to check, whether at least one zookeeper server in the host list is avaiable at the connecting time. I have made a patch for this issue, could you like to check it out? Anyway, a "strategy" pattern for connection would be great, I think we should to that. > C Client should check the connectivity to the hosts in zookeeper_init > --------------------------------------------------------------------- > > Key: ZOOKEEPER-779 > URL: https://issues.apache.org/jira/browse/ZOOKEEPER-779 > Project: Zookeeper > Issue Type: Improvement > Components: c client > Affects Versions: 3.3.1 > Reporter: Qian Ye > > In some scenario, whether the client can connect to zookeeper servers is used > as a logic condition. If the client cannot connect to the servers, the > program should turn to another fork. However, current zookeeper_init could > not tell whether the client can connect to one server or not. It could make > some users feel confused. I think we should check the connectivity to the > host in zookeeper_init, so we can tell whether the hosts are avaiable at that > time or not. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.