use of com.netflix.discovery.shared.resolver.ClusterResolverException in project eureka by Netflix.
the class DnsTxtRecordClusterResolver method resolve.
private static List<AwsEndpoint> resolve(String region, String rootClusterDNS, boolean extractZone, int port, boolean isSecure, String relativeUri) {
try {
Set<String> zoneDomainNames = resolve(rootClusterDNS);
if (zoneDomainNames.isEmpty()) {
throw new ClusterResolverException("Cannot resolve Eureka cluster addresses; there are no data in TXT record for DN " + rootClusterDNS);
}
List<AwsEndpoint> endpoints = new ArrayList<>();
for (String zoneDomain : zoneDomainNames) {
String zone = extractZone ? ResolverUtils.extractZoneFromHostName(zoneDomain) : null;
Set<String> zoneAddresses = resolve(zoneDomain);
for (String address : zoneAddresses) {
endpoints.add(new AwsEndpoint(address, port, isSecure, relativeUri, region, zone));
}
}
return endpoints;
} catch (NamingException e) {
throw new ClusterResolverException("Cannot resolve Eureka cluster addresses for root: " + rootClusterDNS, e);
}
}
Aggregations