liubao68 commented on a change in pull request #2391:
URL: 
https://github.com/apache/servicecomb-java-chassis/pull/2391#discussion_r639349974



##########
File path: 
service-registry/registry-service-center/src/main/java/org/apache/servicecomb/serviceregistry/client/IpPortManager.java
##########
@@ -91,22 +91,14 @@ public void initAutoDiscovery() {
     }
   }
 
-  public IpPort getNextAvailableAddress(IpPort failedIpPort) {
+  public IpPort getAvailableAddress() {
     int currentIndex = currentAvailableIndex.get();
-    IpPort current = getAvailableAddress(currentIndex);
-    if (current.equals(failedIpPort)) {
-      currentAvailableIndex.compareAndSet(currentIndex, currentIndex + 1);
-      current = getAvailableAddress();
-    }
-
-    LOGGER.info("Change service center address from {} to {}", 
failedIpPort.toString(), current.toString());
+    currentAvailableIndex.compareAndSet(currentIndex, currentIndex + 1);
+    IpPort current =  getAvailableAddress(currentAvailableIndex.get());

Review comment:
       Maybe currentIndex.increamentAndGet is much simpler. 




-- 
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.

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


Reply via email to