文章目录
1. 监听器的特点
1.1. 一次性触发
客户端注册监听之后,事件发生后会触发客户端监听器,但仅会触发一次
1.2. 事件封装
1.3. 异步触发
1.4. 先注册再触发
2. 监听器相关的命令
ls [-s] [-w] [-R] path
config [-c] [-w] [-s]
get [-s] [-w] path
stat [-w] path
2.1. stat监听内容
2.1.1. 节点创建
WatchedEvent state:SyncConnected type:NodeCreated path:/g
2.1.2. 节点删除
WatchedEvent state:SyncConnected type:NodeDeleted path:/f
2.1.3. 节点数据修改
WatchedEvent state:SyncConnected type:NodeDataChanged path:/g
2.2. get监听内容
2.2.1. 节点数据修改
WatchedEvent state:SyncConnected type:NodeDataChanged path:/a
2.3. ls监听内容
2.3.1. 节点删除
WatchedEvent state:SyncConnected type:NodeDeleted path:/a
2.3.2. 一级子节点创建
WatchedEvent state:SyncConnected type:NodeChildrenChanged path:/a
2.3.3. 一级子节点删除
WatchedEvent state:SyncConnected type:NodeChildrenChanged path:/a