deer2010 发表于 2015-9-7 07:12:48

Zookeeper watch参照表

  Watcher 设置是开发中最常见的,需要搞清楚watcher的一些基本特征,对于exists、getdata、getchild对于节点的不同操 作会收到不同的 watcher信息。对父节点的变更以及孙节点的变更都不会触发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×注: state = 2 表示删除事件;state = 3表示节点数据变更;state =4表示子节点事件;state = -1表示 session事件。 type = -112表示session失效;type = 1表示session建立中;tpye = = 3表示 session建立成功。×表示否,√表示是。
页: [1]
查看完整版本: Zookeeper watch参照表