add timeout ZkclientZookeeperClient

This commit is contained in:
Jerry Lee 2014-03-14 19:21:55 +08:00
parent 45e66f4224
commit 40b5dadfe4
1 changed files with 3 additions and 1 deletions

View File

@ -22,7 +22,9 @@ public class ZkclientZookeeperClient extends AbstractZookeeperClient<IZkChildLis
public ZkclientZookeeperClient(URL url) {
super(url);
client = new ZkClient(url.getBackupAddress());
int timeout = url.getParameter("timeout", 1000);
client = new ZkClient(url.getBackupAddress(), timeout, timeout);
client.subscribeStateChanges(new IZkStateListener() {
public void handleStateChanged(KeeperState state) throws Exception {
ZkclientZookeeperClient.this.state = state;