Watcher事件类型(二)

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_26641781/article/details/83304475
  • ls为父节点设置watcher,创建子节点触发:NodeChild
[zk: localhost:2181(CONNECTED) 29] ls /
[imocc, zookeeper]
[zk: localhost:2181(CONNECTED) 31] ls /imocc watch
[]
[zk: localhost:2181(CONNECTED) 33] create /imocc/abc 11 

WATCHER::

WatchedEvent state:SyncConnected type:NodeChildrenChanged path:/imocc
Created /imocc/abc

  • ls为父节点设置watcher,删除子节点触发:NodeChildrenChanged
[zk: localhost:2181(CONNECTED) 34] ls /imocc watch      
[abc]
[zk: localhost:2181(CONNECTED) 35] delete /imocc/abc

WATCHER::

WatchedEvent state:SyncConnected type:NodeChildrenChanged path:/imocc

  • ls为父节点设置watcher,修改子节点不触发:
[zk: localhost:2181(CONNECTED) 36] ls /imocc watch  
[]
[zk: localhost:2181(CONNECTED) 37] create /imocc/zxc 6

WATCHER::

WatchedEvent state:SyncConnected type:NodeChildrenChanged path:/imocc
Created /imocc/zxc
[zk: localhost:2181(CONNECTED) 38] ls /imocc watch    
[zxc]
[zk: localhost:2181(CONNECTED) 39] set /imocc/zxc 7
cZxid = 0x20000000c
ctime = Tue Oct 23 11:31:23 CST 2018
mZxid = 0x20000000d
mtime = Tue Oct 23 11:31:57 CST 2018
pZxid = 0x20000000c
cversion = 0
dataVersion = 1
aclVersion = 0
ephemeralOwner = 0x0
dataLength = 1
numChildren = 0

猜你喜欢

转载自blog.csdn.net/qq_26641781/article/details/83304475