zookeeper有其官网的java客户端,但是使用起来不够人性化,所以有人对zookeeper客户端进行了封装,这就是ZkClient.
今天试了下关于ZkClient的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 {
}
}