This commit is contained in:
THY 2019-02-24 14:20:57 +08:00 committed by Xiaojie Li
parent 6b589f0d5a
commit e89b3f2728
1 changed files with 5 additions and 0 deletions

View File

@ -38,6 +38,8 @@ import java.util.concurrent.CountDownLatch;
*
*/
public class CacheListener implements TreeCacheListener {
private static final byte[] EMPTY_BYTES = new byte[0];
private Map<String, Set<ConfigurationListener>> keyListeners = new ConcurrentHashMap<>();
private CountDownLatch initializedLatch;
private String rootPath;
@ -83,6 +85,9 @@ public class CacheListener implements TreeCacheListener {
return;
}
if (value == null) {
value = EMPTY_BYTES;
}
ConfigChangeEvent configChangeEvent = new ConfigChangeEvent(key, new String(value, StandardCharsets.UTF_8), changeType);
Set<ConfigurationListener> listeners = keyListeners.get(key);
if (CollectionUtils.isNotEmpty(listeners)) {