<pre name="code" class="html">如果在连接时候zk服务器宕机 To create a client session the application code must provide a connection string containing a comma separated list of host:port pairs, each corresponding to a ZooKeeper server (e.g. &q…
Zookeeper 重连机制 public class ZKConnectSessionWatcher implements Watcher { public final static String zkServerPath = "10.10.10.10:2181"; public final static int timeout = 5000; public static void main(String[] args) throws Exception { ZooKeeper zk…