You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by ke...@apache.org on 2019/03/26 01:09:46 UTC
[incubator-dubbo] branch master updated: Fixes #3625 (#3730)
This is an automated email from the ASF dual-hosted git repository.
kexianjun pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-dubbo.git
The following commit(s) were added to refs/heads/master by this push:
new ad72159 Fixes #3625 (#3730)
ad72159 is described below
commit ad72159b0e3ff641e3a08754297c81278b94d94e
Author: John-Smile <hm...@126.com>
AuthorDate: Tue Mar 26 09:09:11 2019 +0800
Fixes #3625 (#3730)
use constant to replace magic number
---
.../apache/dubbo/configcenter/support/zookeeper/CacheListener.java | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
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 4f6c638..3eaa96b 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 @@ import java.util.concurrent.CountDownLatch;
*/
public class CacheListener implements DataListener {
+ private static final int MIN_PATH_DEPTH = 5;
+
private Map<String, Set<ConfigurationListener>> keyListeners = new ConcurrentHashMap<>();
private CountDownLatch initializedLatch;
private String rootPath;
@@ -89,7 +91,7 @@ public class CacheListener implements DataListener {
// 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) {