栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 前沿技术 > 大数据 > 大数据系统

zookeeper curator PathChildrenCache 记录

zookeeper curator PathChildrenCache 记录

https://blog.csdn.net/hosaos/article/details/88658676对NodeCache,PathChildrenCache,TreeCache做了比较详尽的分析,但有一点没有说的很直接:对于PathChildrenCache,不同的startMode:

**
     * Method of priming cache on {@link PathChildrenCache#start(StartMode)}
     */
    public enum StartMode
    {
        
        NORMAL,

        
        BUILD_INITIAL_CACHE,

        
        POST_INITIALIZED_EVENT
    }

NORMAL,所有已经存在的childnode ,都会触发eventBUILD_INITIAL_CACHE,block模式初始化cache,只有新的child node变化才会触发实际POST_INITIALIZED_EVENT,在NORMAL的基础上触发INITIALIZED事件,但这个时间的child node的事件并不能保证时间顺序

另外PathChildrenCache本质还是TreeCache,可以从触发事件stack看到如下信息

Daemon Thread [main-EventThread] (Suspended (breakpoint at line 834 in TreeCache))	
	TreeCache.publishEvent(TreeCacheEvent) line: 834	
	TreeCache.publishEvent(TreeCacheEvent$Type, ChildData) line: 827	
	TreeCache.access$700(TreeCache, TreeCacheEvent$Type, ChildData) line: 71	
	TreeCache$TreeNode.processResult(Curatorframework, CuratorEvent) line: 452	
	CuratorframeworkImpl.sendToBackgroundCallback(OperationAndData, CuratorEvent) line: 749	
	CuratorframeworkImpl.processBackgroundOperation(OperationAndData, CuratorEvent) line: 522	
	GetDataBuilderImpl$3.processResult(int, String, Object, byte[], Stat) line: 256	
	ClientCnxn$EventThread.processEvent(Object) line: 561	
	ClientCnxn$EventThread.run() line: 498	
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/747322.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号