Zookeeper has its official website of the Java client, but not enough user-friendly, so someone zookeeper the client is encapsulated, this is zkclient.
Today, I tried to use the API for zkclient . Because of the time problem, first put out back to have time in the collation
(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 { } }
Use of the Zkclient jar package