This is an automated email from the ASF dual-hosted git repository.

wusheng pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/skywalking-java.git


The following commit(s) were added to refs/heads/main by this push:
     new c38a19c6c6 fix the conditions for resetting uuid in dynamic 
configuration (#588)
c38a19c6c6 is described below

commit c38a19c6c6eebfed17da55059f61799b8613b272
Author: xzyJavaX <[email protected]>
AuthorDate: Sat Jul 29 03:29:17 2023 +0800

    fix the conditions for resetting uuid in dynamic configuration (#588)
---
 CHANGES.md                                                        | 1 +
 .../agent/core/conf/dynamic/ConfigurationDiscoveryService.java    | 8 +++++++-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/CHANGES.md b/CHANGES.md
index 06e524ef27..039e7c2d4d 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -149,6 +149,7 @@ Callable {
 * Upgrade guava to 32.0.1
 * Fix issue with duplicate enhancement by ThreadPoolExecutor
 * Add plugin to support for RESTeasy 6.x.
+* Fix the conditions for resetting uuid, avoid the same uuid causing the 
configuration not to be updated. 
 
 #### Documentation
 
diff --git 
a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/conf/dynamic/ConfigurationDiscoveryService.java
 
b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/conf/dynamic/ConfigurationDiscoveryService.java
index 9e53452bcb..661adc60ca 100644
--- 
a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/conf/dynamic/ConfigurationDiscoveryService.java
+++ 
b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/conf/dynamic/ConfigurationDiscoveryService.java
@@ -219,7 +219,7 @@ public class ConfigurationDiscoveryService implements 
BootService, GRPCChannelLi
                 builder.setService(Config.Agent.SERVICE_NAME);
 
                 // Some plugin will register watcher later.
-                final int size = register.keys().size();
+                final int size = register.getRegisterWatcherSize();
                 if (lastRegisterWatcherSize != size) {
                     // reset uuid, avoid the same uuid causing the 
configuration not to be updated.
                     uuid = null;
@@ -273,6 +273,12 @@ public class ConfigurationDiscoveryService implements 
BootService, GRPCChannelLi
             return register.keySet();
         }
 
+        public int getRegisterWatcherSize() {
+            return register.values().stream()
+                    .mapToInt(List::size)
+                    .sum();
+        }
+
         @Override
         public String toString() {
             ArrayList<String> registerTableDescription = new 
ArrayList<>(register.size());

Reply via email to