/** * @deprecated see replacement in {@link com.netflix.discovery.endpoint.EndpointUtils} * * Get the list of all eureka service urls from DNS for the eureka client to * talk to. The client picks up the service url from its zone and then fails over to * other zones randomly. If there are multiple servers in the same zone, the client once * again picks one randomly. This way the traffic will be distributed in the case of failures. * * @param instanceZone The zone in which the client resides. * @param preferSameZone true if we have to prefer the same zone as the client, false otherwise. * @return The list of all eureka service urls for the eureka client to talk to. */ @Deprecated @Override public List<String> getServiceUrlsFromDNS(String instanceZone, boolean preferSameZone) { return EndpointUtils.getServiceUrlsFromDNS(clientConfig, instanceZone, preferSameZone, urlRandomizer); }
private Collection<String> getIPsForZoneFromDNS(String myZone) { return EndpointUtils.getServiceUrlsFromDNS( clientConfig, myZone, true, new EndpointUtils.InstanceInfoBasedUrlRandomizer(applicationInfoManager.getInfo()) ); }
/** * Get the list of EIPS from the DNS. * * <p> * This mechanism looks for the EIP pool in the zone the instance is in by * looking up the DNS name <code>{zone}.{region}.{domainName}</code>. The * zone is fetched from the {@link InstanceInfo} object;the region is picked * up from the specified configuration * {@link com.netflix.discovery.EurekaClientConfig#getRegion()};the domain name is picked up from * the specified configuration {@link com.netflix.discovery.EurekaClientConfig#getEurekaServerDNSName()} * with a "txt." prefix (see {@link com.netflix.discovery.endpoint.EndpointUtils * #getZoneBasedDiscoveryUrlsFromRegion(com.netflix.discovery.EurekaClientConfig, String)}. * </p> * * @param myZone * the zone where this instance exist in. * @return the collection of EIPs that exist in the zone this instance is * in. */ private Collection<String> getEIPsForZoneFromDNS(String myZone) { List<String> ec2Urls = EndpointUtils.getServiceUrlsFromDNS( clientConfig, myZone, true, new EndpointUtils.InstanceInfoBasedUrlRandomizer(applicationInfoManager.getInfo()) ); return getEIPsFromServiceUrls(ec2Urls); }
/** * Get the list of all eureka service urls for the eureka client to talk to. * * @param clientConfig the clientConfig to use * @param zone the zone in which the client resides * @param randomizer a randomizer to randomized returned urls, if loading from dns * * @return The list of all eureka service urls for the eureka client to talk to. */ public static List<String> getDiscoveryServiceUrls(EurekaClientConfig clientConfig, String zone, ServiceUrlRandomizer randomizer) { boolean shouldUseDns = clientConfig.shouldUseDnsForFetchingServiceUrls(); if (shouldUseDns) { return getServiceUrlsFromDNS(clientConfig, zone, clientConfig.shouldPreferSameZoneEureka(), randomizer); } return getServiceUrlsFromConfig(clientConfig, zone, clientConfig.shouldPreferSameZoneEureka()); }
/** * @deprecated see replacement in {@link com.netflix.discovery.endpoint.EndpointUtils} * * Get the list of all eureka service urls from DNS for the eureka client to * talk to. The client picks up the service url from its zone and then fails over to * other zones randomly. If there are multiple servers in the same zone, the client once * again picks one randomly. This way the traffic will be distributed in the case of failures. * * @param instanceZone The zone in which the client resides. * @param preferSameZone true if we have to prefer the same zone as the client, false otherwise. * @return The list of all eureka service urls for the eureka client to talk to. */ @Deprecated @Override public List<String> getServiceUrlsFromDNS(String instanceZone, boolean preferSameZone) { return EndpointUtils.getServiceUrlsFromDNS(clientConfig, instanceZone, preferSameZone, urlRandomizer); }
private Collection<String> getIPsForZoneFromDNS(String myZone) { return EndpointUtils.getServiceUrlsFromDNS( clientConfig, myZone, true, new EndpointUtils.InstanceInfoBasedUrlRandomizer(applicationInfoManager.getInfo()) ); }
/** * Get the list of EIPS from the DNS. * * <p> * This mechanism looks for the EIP pool in the zone the instance is in by * looking up the DNS name <code>{zone}.{region}.{domainName}</code>. The * zone is fetched from the {@link InstanceInfo} object;the region is picked * up from the specified configuration * {@link com.netflix.discovery.EurekaClientConfig#getRegion()};the domain name is picked up from * the specified configuration {@link com.netflix.discovery.EurekaClientConfig#getEurekaServerDNSName()} * with a "txt." prefix (see {@link com.netflix.discovery.endpoint.EndpointUtils * #getZoneBasedDiscoveryUrlsFromRegion(com.netflix.discovery.EurekaClientConfig, String)}. * </p> * * @param myZone * the zone where this instance exist in. * @return the collection of EIPs that exist in the zone this instance is * in. */ private Collection<String> getEIPsForZoneFromDNS(String myZone) { List<String> ec2Urls = EndpointUtils.getServiceUrlsFromDNS( clientConfig, myZone, true, new EndpointUtils.InstanceInfoBasedUrlRandomizer(applicationInfoManager.getInfo()) ); return getEIPsFromServiceUrls(ec2Urls); }
/** * Get the list of all eureka service urls for the eureka client to talk to. * * @param clientConfig the clientConfig to use * @param zone the zone in which the client resides * @param randomizer a randomizer to randomized returned urls, if loading from dns * * @return The list of all eureka service urls for the eureka client to talk to. */ public static List<String> getDiscoveryServiceUrls(EurekaClientConfig clientConfig, String zone, ServiceUrlRandomizer randomizer) { boolean shouldUseDns = clientConfig.shouldUseDnsForFetchingServiceUrls(); if (shouldUseDns) { return getServiceUrlsFromDNS(clientConfig, zone, clientConfig.shouldPreferSameZoneEureka(), randomizer); } return getServiceUrlsFromConfig(clientConfig, zone, clientConfig.shouldPreferSameZoneEureka()); }