AbstractDataSource
public T loadConfig() throws Exception { return loadConfig(readSource()); } public T loadConfig(S conf) throws Exception { T value = parser.convert(conf); return value; }父类的loadConfig会调用子类的readSource读取配置信息,然后调用parser.convert进行反序列化。
ZookeeperDataSource#readSource
public String readSource() throws Exception { if (this.zkClient == null) { throw new IllegalStateException("Zookeeper has not been initialized or error occurred"); } String configInfo = null; ChildData childData = nodeCache.getCurrentData(); if (null != childData && childData.getData() != null) { configInfo = new String(childData.getData()); } return configInfo; }这个方法是用来读取zk节点里面的信息。
最后FlowRuleManager.register2Property的方法就和上面的文件动态配置的是一样的了。
java学习笔记/SENTINEL