How to register a watcher on the client side in zookeeper?

Alibaba cloud Q & A 2022-02-13 05:26:01 阅读数:966

register watcher client zookeeper

Zookeeper in , Register on the client side watcher How to achieve ?




Take the answer 1:

(1) call getData()/getChildren()/exist() Three API, Pass in Watcher object

(2) Tag request request, encapsulation Watcher To WatchRegistration

(3) Encapsulated into Packet object , Send to the server request

(4) After receiving the server response , take Watcher Sign up to ZKWatcherManager Ongoing management

(5) Request returns , To complete the registration .


copyright:author[Alibaba cloud Q & A],Please bring the original link to reprint, thank you. https://en.javamana.com/2022/02/202202130526003636.html