Merge 2.1.x.
This commit is contained in:
@@ -20,7 +20,6 @@ import java.net.URI;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -197,21 +196,16 @@ public class EurekaController {
|
||||
else {
|
||||
zoneCounts.put(zone, 1);
|
||||
}
|
||||
List<Pair<String, String>> list = instancesByStatus.get(status);
|
||||
if (list == null) {
|
||||
list = new ArrayList<>();
|
||||
instancesByStatus.put(status, list);
|
||||
}
|
||||
List<Pair<String, String>> list = instancesByStatus
|
||||
.computeIfAbsent(status, k -> new ArrayList<>());
|
||||
list.add(new Pair<>(id, url));
|
||||
}
|
||||
appData.put("amiCounts", amiCounts.entrySet());
|
||||
appData.put("zoneCounts", zoneCounts.entrySet());
|
||||
ArrayList<Map<String, Object>> instanceInfos = new ArrayList<>();
|
||||
appData.put("instanceInfos", instanceInfos);
|
||||
for (Iterator<Map.Entry<InstanceInfo.InstanceStatus, List<Pair<String, String>>>> iter = instancesByStatus
|
||||
.entrySet().iterator(); iter.hasNext();) {
|
||||
Map.Entry<InstanceInfo.InstanceStatus, List<Pair<String, String>>> entry = iter
|
||||
.next();
|
||||
for (Map.Entry<InstanceInfo.InstanceStatus, List<Pair<String, String>>> entry : instancesByStatus
|
||||
.entrySet()) {
|
||||
List<Pair<String, String>> value = entry.getValue();
|
||||
InstanceInfo.InstanceStatus status = entry.getKey();
|
||||
LinkedHashMap<String, Object> instanceData = new LinkedHashMap<>();
|
||||
@@ -296,8 +290,8 @@ public class EurekaController {
|
||||
StringBuilder filteredUrls = new StringBuilder();
|
||||
for (String u : urls) {
|
||||
if (u.contains("@")) {
|
||||
filteredUrls.append(u.substring(0, u.indexOf("//") + 2))
|
||||
.append(u.substring(u.indexOf("@") + 1, u.length())).append(",");
|
||||
filteredUrls.append(u, 0, u.indexOf("//") + 2)
|
||||
.append(u.substring(u.indexOf("@") + 1)).append(",");
|
||||
}
|
||||
else {
|
||||
filteredUrls.append(u).append(",");
|
||||
|
||||
@@ -64,23 +64,20 @@ public class EurekaServerInitializerConfiguration
|
||||
|
||||
@Override
|
||||
public void start() {
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
// TODO: is this class even needed now?
|
||||
eurekaServerBootstrap.contextInitialized(
|
||||
EurekaServerInitializerConfiguration.this.servletContext);
|
||||
log.info("Started Eureka Server");
|
||||
new Thread(() -> {
|
||||
try {
|
||||
// TODO: is this class even needed now?
|
||||
eurekaServerBootstrap.contextInitialized(
|
||||
EurekaServerInitializerConfiguration.this.servletContext);
|
||||
log.info("Started Eureka Server");
|
||||
|
||||
publish(new EurekaRegistryAvailableEvent(getEurekaServerConfig()));
|
||||
EurekaServerInitializerConfiguration.this.running = true;
|
||||
publish(new EurekaServerStartedEvent(getEurekaServerConfig()));
|
||||
}
|
||||
catch (Exception ex) {
|
||||
// Help!
|
||||
log.error("Could not initialize Eureka servlet context", ex);
|
||||
}
|
||||
publish(new EurekaRegistryAvailableEvent(getEurekaServerConfig()));
|
||||
EurekaServerInitializerConfiguration.this.running = true;
|
||||
publish(new EurekaServerStartedEvent(getEurekaServerConfig()));
|
||||
}
|
||||
catch (Exception ex) {
|
||||
// Help!
|
||||
log.error("Could not initialize Eureka servlet context", ex);
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ public class RefreshablePeerEurekaNodesTests {
|
||||
"eureka.client.region=unavailable-region", // to force defaultZone
|
||||
"eureka.client.service-url.defaultZone=https://default-host1:8678/eureka/");
|
||||
this.context.publishEvent(new EnvironmentChangeEvent(
|
||||
new HashSet<String>(Arrays.asList(USE_DNS, DEFAULT_ZONE))));
|
||||
new HashSet<>(Arrays.asList(USE_DNS, DEFAULT_ZONE))));
|
||||
|
||||
assertThat(serviceUrlMatches("https://default-host1:8678/eureka/")).as(
|
||||
"PeerEurekaNodes' are updated when eureka.client.use-dns-for-fetching-service-urls is true")
|
||||
@@ -98,7 +98,7 @@ public class RefreshablePeerEurekaNodesTests {
|
||||
"eureka.client.region=unavailable-region", // to force defaultZone
|
||||
"eureka.client.service-url.defaultZone=https://default-host2:8678/eureka/");
|
||||
this.context.publishEvent(new EnvironmentChangeEvent(
|
||||
new HashSet<String>(Arrays.asList(USE_DNS, DEFAULT_ZONE))));
|
||||
new HashSet<>(Arrays.asList(USE_DNS, DEFAULT_ZONE))));
|
||||
|
||||
assertThat(serviceUrlMatches("https://default-host2:8678/eureka/")).as(
|
||||
"PeerEurekaNodes' are not updated when eureka.client.use-dns-for-fetching-service-urls is false")
|
||||
|
||||
Reference in New Issue
Block a user