Patrick Hunt commented on ZOOKEEPER-779:

Perhaps you could comment further - if you had such a feature what would do 
with the information? What do you mean by "check connectivity?" Is this just 
for reporting (client log), or something else (ie would you want to run code in 
these cases)? 

Recently I've been thinking we should introduce a way for users to easily 
select how the client connects to a server (the zk ensemble). A 'strategy' 
pattern might work well here. We already have two strategies - round robin and 
shuffled round robin. We could allow user implemented strategies - this would 
allow for the type of feature you are requesting. You could implement your own 
strategy (or extend the existing ones). For example, there have been requests 
to have the client connect to the "closest" or "least loaded" server. 
Strategies could be implemented for these fairly easily (measure latency and 
session load respectively say). Shouldn't be too hard to implement either - 
some though on the design of the interface, but mainly refactoring what we 
currently have to make it more modular.

> 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.

Reply via email to