From a1a877881354647d83c2559fc684f40e1fdcaefe Mon Sep 17 00:00:00 2001 From: telami <907848106@qq.com> Date: Tue, 4 Aug 2020 21:30:32 +0800 Subject: [PATCH] :bulb: Query node data from the configuration file. --- .../src/main/java/com/crossoverjie/cim/route/kit/ZKit.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cim-forward-route/src/main/java/com/crossoverjie/cim/route/kit/ZKit.java b/cim-forward-route/src/main/java/com/crossoverjie/cim/route/kit/ZKit.java index 2b9c76de..268db12b 100644 --- a/cim-forward-route/src/main/java/com/crossoverjie/cim/route/kit/ZKit.java +++ b/cim-forward-route/src/main/java/com/crossoverjie/cim/route/kit/ZKit.java @@ -2,6 +2,7 @@ import com.alibaba.fastjson.JSON; import com.crossoverjie.cim.route.cache.ServerCache; +import com.crossoverjie.cim.route.config.AppConfiguration; import org.I0Itec.zkclient.IZkChildListener; import org.I0Itec.zkclient.ZkClient; import org.slf4j.Logger; @@ -30,6 +31,8 @@ public class ZKit { @Autowired private ServerCache serverCache ; + @Autowired + private AppConfiguration appConfiguration; /** * 监听事件 @@ -56,7 +59,7 @@ public void handleChildChange(String parentPath, List currentChildren) t * @return */ public List getAllNode(){ - List children = zkClient.getChildren("/route"); + List children = zkClient.getChildren(appConfiguration.getZkRoot()); logger.info("Query all node =[{}] success.", JSON.toJSONString(children)); return children; }