zookeeper有其官網的java客戶端,可是使用起來不夠人性化,因此有人對zookeeper客戶端進行了封裝,這就是ZkClient.java
今天試了下關於ZkClient的api使用。因爲時間問題,先貼出來回頭有時間在整理下api
(String[] args) { String serverString = ZkClient zkClient = ZkClient(serverString)isExist = zkClient.exists()System..println(isExist)zkClient.writeData()String data = zkClient.readData()System..println(data)} MyZkChildListener IZkChildListener { (String sList<String> list) Exception { System..println(+ s)System..println(+ list)} } MyZkDataChangeListener IZkDataListener { (String sObject o) Exception { System..println(s + + o)} (String s) Exception { System..println(s + )} } MyZkStatChangeListener IZkStateListener { (Watcher.Event.KeeperState keeperState) Exception { System..println()} () Exception { } (Throwable throwable) Exception { } }