diff --git a/dubbo-configcenter/dubbo-configcenter-zookeeper/src/main/java/org/apache/dubbo/configcenter/support/zookeeper/CacheListener.java b/dubbo-configcenter/dubbo-configcenter-zookeeper/src/main/java/org/apache/dubbo/configcenter/support/zookeeper/CacheListener.java index 4f6c6382952..3eaa96b28a9 100644 --- a/dubbo-configcenter/dubbo-configcenter-zookeeper/src/main/java/org/apache/dubbo/configcenter/support/zookeeper/CacheListener.java +++ b/dubbo-configcenter/dubbo-configcenter-zookeeper/src/main/java/org/apache/dubbo/configcenter/support/zookeeper/CacheListener.java @@ -35,6 +35,8 @@ */ public class CacheListener implements DataListener { + private static final int MIN_PATH_DEPTH = 5; + private Map> keyListeners = new ConcurrentHashMap<>(); private CountDownLatch initializedLatch; private String rootPath; @@ -89,7 +91,7 @@ public void dataChanged(String path, Object value, EventType eventType) { // TODO We limit the notification of config changes to a specific path level, for example // /dubbo/config/service/configurators, other config changes not in this level will not get notified, // say /dubbo/config/dubbo.properties - if (path.split("/").length >= 5) { + if (path.split("/").length >= MIN_PATH_DEPTH) { String key = pathToKey(path); ConfigChangeType changeType; switch (eventType) {