wu-sheng commented on a change in pull request #7509: URL: https://github.com/apache/skywalking/pull/7509#discussion_r693742547
########## File path: oap-server/server-configuration/configuration-api/src/main/java/org/apache/skywalking/oap/server/configuration/api/ConfigWatcherRegister.java ########## @@ -55,16 +56,28 @@ synchronized public void registerConfigChangeWatcher(ConfigChangeWatcher watcher } WatcherHolder holder = new WatcherHolder(watcher); - if (register.containsKey(holder.getKey())) { + if (singleConfigChangeWatcherRegister.containsKey( + holder.getKey()) || groupConfigChangeWatcherRegister.containsKey(holder.getKey())) { throw new IllegalStateException("Duplicate register, watcher=" + watcher); } - register.put(holder.getKey(), holder); + + switch (holder.getWatcher().getWatchType()) { + case SINGLE: + singleConfigChangeWatcherRegister.put(holder.getKey(), holder); + break; + case GROUP: + groupConfigChangeWatcherRegister.put(holder.getKey(), holder); + break; + default: + throw new IllegalArgumentException( + "Unexpected watch type of ConfigChangeWatcher " + watcher.toString()); + } } public void start() { isStarted = true; - LOGGER.info("Current configurations after the bootstrap sync." + LINE_SEPARATOR + register.toString()); + LOGGER.info("Current configurations after the bootstrap sync." + LINE_SEPARATOR + singleConfigChangeWatcherRegister.toString()); Review comment: @sonatype-lift ingore ########## File path: oap-server/server-configuration/configuration-api/src/main/java/org/apache/skywalking/oap/server/configuration/api/ConfigWatcherRegister.java ########## @@ -55,16 +56,28 @@ synchronized public void registerConfigChangeWatcher(ConfigChangeWatcher watcher } WatcherHolder holder = new WatcherHolder(watcher); - if (register.containsKey(holder.getKey())) { + if (singleConfigChangeWatcherRegister.containsKey( + holder.getKey()) || groupConfigChangeWatcherRegister.containsKey(holder.getKey())) { throw new IllegalStateException("Duplicate register, watcher=" + watcher); } - register.put(holder.getKey(), holder); + + switch (holder.getWatcher().getWatchType()) { + case SINGLE: + singleConfigChangeWatcherRegister.put(holder.getKey(), holder); + break; + case GROUP: + groupConfigChangeWatcherRegister.put(holder.getKey(), holder); + break; + default: + throw new IllegalArgumentException( + "Unexpected watch type of ConfigChangeWatcher " + watcher.toString()); + } } public void start() { isStarted = true; - LOGGER.info("Current configurations after the bootstrap sync." + LINE_SEPARATOR + register.toString()); + LOGGER.info("Current configurations after the bootstrap sync." + LINE_SEPARATOR + singleConfigChangeWatcherRegister.toString()); Review comment: @sonatype-lift ignore -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@skywalking.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org