wangchengming666 commented on code in PR #10297:
URL: https://github.com/apache/dubbo/pull/10297#discussion_r917494886


##########
dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/event/listener/ServiceInstancesChangedListener.java:
##########
@@ -511,16 +517,20 @@ protected Set<String> getProtocolServiceKeyList(String 
serviceKey, NotifyListene
     protected class AddressRefreshRetryTask implements Runnable {
         private final RetryServiceInstancesChangedEvent retryEvent;
         private final Semaphore retryPermission;
+        private final int retryCount;
 
-        public AddressRefreshRetryTask(Semaphore semaphore, String 
serviceName) {
-            this.retryEvent = new 
RetryServiceInstancesChangedEvent(serviceName);
+        public AddressRefreshRetryTask(Semaphore semaphore, String 
serviceName, int retryCount) {
+            this.retryEvent = new 
RetryServiceInstancesChangedEvent(serviceName, retryCount);
             this.retryPermission = semaphore;
+            this.retryCount = retryCount;
         }
 
         @Override
         public void run() {
             retryPermission.release();
-            ServiceInstancesChangedListener.this.onEvent(retryEvent);
+            if (retryCount < 3) {
+                ServiceInstancesChangedListener.this.onEvent(retryEvent);

Review Comment:
   maybe record some detail log is more acceptable



##########
dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/event/RetryServiceInstancesChangedEvent.java:
##########
@@ -25,12 +25,19 @@ public class RetryServiceInstancesChangedEvent extends 
ServiceInstancesChangedEv
 
     private volatile long failureRecordTime;
 
-    public RetryServiceInstancesChangedEvent(String serviceName) {
+    private volatile int retryCount;

Review Comment:
   AtomicInteger maybe better



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to