Zookeeper如何正确设置和获取watcher
来源:互联网 发布:蓝鸟中文编程破解版 编辑:程序博客网 时间:2024/06/05 19:19
http://blog.csdn.net/qq910894904/article/details/41726279
Zookeeper如何正确设置和获取watcher
Watcher 设置是开发中最常见的,需要搞清楚watcher的一些基本特征,对于exists、getdata、getchild对于节点的不同操作会收到不同的 watcher信息
state= -113 认证失败状态
state= 1 连接建立中
state= 2 (暂时不清楚如何理解这个状态,ZOO_ASSOCIATING_STATE)
state=3 连接已建立状态
state= 999 无连接状态
type=1 创建节点事件
type=2 删除节点事件
type=3 更改节点事件
type=4 子节点列表变化事件
type= -1 会话session事件
type=-2 监控被移除事件
对父节点的变更以及孙节点的变更都不会触发watcher,而对watcher本身节点以及子节点的变更会触发watcher,具体参照下表。
操作方法触发watcherwatcher statewatcher typewatcher pathCreate当前节点getdata××××getchildren√34√exists××××set当前节点getdata√33√getchildren××××exists√33√delete当前节点getdata√32√getchildren√32√exists√32√create子节点getdata××××getchildren√34√exists××××set子节点getdata××××getchildren××××exists××××delete子节点getdata××××getchildren√34√exists××××恢复连接getdata√1-1×getchildren√1-1×exists√1-1×恢复连接session未超时getdata√-112-1×getchildren√-112-1×exists√-112-1×恢复连接session超时getdata√3-1×getchildren√3-1×exists√3-1×注:×表示否,√表示是。
更多参见 http://tech.uc.cn/?p=1189,不过该文章中第五节对event和state的说明有误,请仔细辨别。
0 0
- Zookeeper如何正确设置和获取watcher
- Zookeeper如何正确设置和获取watcher
- ZooKeeper watcher和version
- zookeeper中Watcher和Notifications
- zookeeper中Watcher和Notifications
- 【Apache ZooKeeper】为ZNode设置watcher
- 分析Zookeeper不提供永久Watcher的原因并如何保证获取最新数据
- Zookeeper--Watcher
- zookeeper中Watcher和AsyncCallback区别
- ZooKeeper 通过client 对指定节点设置watcher的注意事项
- ZooKeeper 通过client 对指定节点设置watcher的注意事项
- java为zookeeper的一个节点设置watcher(监听)
- ZooKeeper源码解析(三):Watcher如何监控ZNode
- ZooKeeper Watcher 和 AsyncCallback 的区别与实现
- Zookeeper学习之Watcher事件类型和ZK状态
- ZooKeeper Watcher执行顺序
- zookeeper watcher功能分析
- zookeeper watcher功能分析
- 文本闪烁函数
- 用StringBuilder连接MYSQL字段时被清空的问题
- 初学VC6.0问题
- OpenMp入门
- Hello Venus - 我是艺术(I'm Ill)
- Zookeeper如何正确设置和获取watcher
- Lazy<Object> 单例
- MAC下安装与配置MySQL
- Spark平台下的组合分类器AdaBoost
- Oracle 的for update行锁
- .Net发布到IIS服务器,IIS服务器配置
- 深入理解android之IPC机制与Binder框架
- 双向认证第一步:Mac OS X中Apache开启ssl
- Opencv图像识别从零到精通(2)-----准备知识