特牛生活网

ZooKeeper源码解析(三):Watcher如何监控ZNode_readresponse()方法-CSDN博客

网友收藏
文章浏览阅读1.5k次。Watcher是一个接口类,有一个接口方法:由用户来实现,后续我们会讲它如何配合ZooKeeper和ClientCnxn来监控节点。上图ZooKeeper中的watchManager实际上是ZKWatchManager,它实现了ClientWatchManager,内部有三个主要成员变量,dataWatches监控数据,比如ZooKeeper类的getData方法会触发该监_readresponse()方法