develpoerX commented on a change in pull request #2691:
URL:
https://github.com/apache/servicecomb-java-chassis/pull/2691#discussion_r790121849
##########
File path:
clients/config-center-client/src/main/java/org/apache/servicecomb/config/center/client/AddressManager.java
##########
@@ -47,16 +54,29 @@ private String formatAddress(String address) {
}
public String address() {
- synchronized (this) {
- this.index++;
- if (this.index >= addresses.size()) {
- this.index = 0;
- }
- return addresses.get(index);
- }
+ return endpointAddress.getAvailableZoneAddress();
}
public boolean sslEnabled() {
- return address().startsWith("https://");
+ isSSLEnable = address().startsWith("https://");
+ return isSSLEnable;
+ }
+
+ public EndpointAddress getEndpointAddress() {
+ return endpointAddress;
+ }
+
+ public void setEndpointAddress(EndpointAddress endpointAddress) {
+ this.endpointAddress = endpointAddress;
+ }
+
+ @Subscribe
+ public void onRefreshEndpointEvent(RefreshEndpointEvent event) {
+ if (null == event || event.getName() != "CseConfigCenter") {
+ return;
+ }
+ endpointAddress.setAvailableZone(event.getSameZone());
+ endpointAddress.setAvailableRegion(event.getSameRegion());
+ endpointAddress.refreshCache();
Review comment:
done
--
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]