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…
基于 Java API 初探 zookeeper 的使用: 先来简单看一下API的使用: public class ConnectionDemo { public static void main(String[] args) { try { final CountDownLatch countDownLatch=new CountDownLatch(1); ZooKeeper zooKeeper= new ZooKeeper("192.168.254.135:2181," + &qu…