You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by GitBox <gi...@apache.org> on 2022/01/22 02:13:01 UTC

[GitHub] [servicecomb-java-chassis] liubao68 commented on a change in pull request #2691: [SCB-2361] Support SC dual cluster multi active mode

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



##########
File path: clients/config-center-client/src/main/java/org/apache/servicecomb/config/center/client/AddressManager.java
##########
@@ -17,25 +17,32 @@
 
 package org.apache.servicecomb.config.center.client;
 
-import java.util.ArrayList;
 import java.util.List;
+import java.util.stream.Collectors;
 
 import org.apache.commons.lang.StringUtils;
+import org.apache.servicecomb.http.client.common.EndpointAddress;
 import org.apache.servicecomb.http.client.common.HttpUtils;
+import org.apache.servicecomb.http.client.event.CommonEventManager;
+import org.apache.servicecomb.http.client.event.RefreshEndpointEvent;
+
+import com.google.common.eventbus.Subscribe;
 
 public class AddressManager {
+
   public static final String DEFAULT_PROJECT = "default";
 
   private final String projectName;
 
-  private final List<String> addresses;
+  private EndpointAddress endpointAddress;
 
-  private int index = 0;
+  private boolean isSSLEnable = false;
 
   public AddressManager(String projectName, List<String> addresses) {
     this.projectName = StringUtils.isEmpty(projectName) ? DEFAULT_PROJECT : projectName;
-    this.addresses = new ArrayList<>(addresses.size());
-    addresses.forEach((address -> this.addresses.add(formatAddress(address))));
+    this.endpointAddress = new EndpointAddress(
+        addresses.stream().map(this::formatAddress).collect(Collectors.toList()));
+    CommonEventManager.register(this);

Review comment:
       Maybe add `public AddressManager(String projectName, List<String> addresses, EventBus eventBus)' is 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: commits-unsubscribe@servicecomb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org