Tabnine Logo
EndpointUtils
Code IndexAdd Tabnine to your IDE (free)

How to use
EndpointUtils
in
com.netflix.discovery.endpoint

Best Java code snippets using com.netflix.discovery.endpoint.EndpointUtils (Showing top 20 results out of 315)

origin: Netflix/eureka

/**
 * @deprecated see replacement in {@link com.netflix.discovery.endpoint.EndpointUtils}
 */
@Deprecated
@Override
public List<String> getDiscoveryServiceUrls(String zone) {
  return EndpointUtils.getDiscoveryServiceUrls(clientConfig, zone, urlRandomizer);
}
origin: Netflix/eureka

/**
 * @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);
}
origin: Netflix/eureka

String region = getRegion(clientConfig);
Map<String, List<String>> zoneDnsNamesMap = getZoneBasedDiscoveryUrlsFromRegion(clientConfig, region);
Set<String> availableZones = zoneDnsNamesMap.keySet();
List<String> zones = new ArrayList<String>(availableZones);
for (String zone : zones) {
  for (String zoneCname : zoneDnsNamesMap.get(zone)) {
    List<String> ec2Urls = new ArrayList<String>(getEC2DiscoveryUrlsFromZone(zoneCname, DiscoveryUrlType.CNAME));
origin: Netflix/eureka

/**
 * 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());
}
origin: Netflix/eureka

String region = getRegion(clientConfig);
String[] availZones = clientConfig.getAvailabilityZones(clientConfig.getRegion());
if (availZones == null || availZones.length == 0) {
int myZoneOffset = getZoneOffset(instanceZone, preferSameZone, availZones);
origin: Netflix/eureka

/**
 * @deprecated use {@link #getServiceUrlsFromConfig(String, boolean)} instead.
 */
@Deprecated
public static List<String> getEurekaServiceUrlsFromConfig(String instanceZone, boolean preferSameZone) {
  return EndpointUtils.getServiceUrlsFromConfig(staticClientConfig, instanceZone, preferSameZone);
}
origin: Netflix/eureka

  @Override
  protected Set<String> getZonesForARegion(String region) {
    Map<String, List<String>> zoneBasedDiscoveryUrlsFromRegion = EndpointUtils
        .getZoneBasedDiscoveryUrlsFromRegion(clientConfig, region);
    if (null != zoneBasedDiscoveryUrlsFromRegion) {
      return zoneBasedDiscoveryUrlsFromRegion.keySet();
    }

    return Collections.emptySet();
  }
}
origin: Netflix/eureka

/**
 * @deprecated see replacement in {@link com.netflix.discovery.endpoint.EndpointUtils}
 *
 * Get the list of EC2 URLs given the zone name.
 *
 * @param dnsName The dns name of the zone-specific CNAME
 * @param type CNAME or EIP that needs to be retrieved
 * @return The list of EC2 URLs associated with the dns name
 */
@Deprecated
public static Set<String> getEC2DiscoveryUrlsFromZone(String dnsName,
                           EndpointUtils.DiscoveryUrlType type) {
  return EndpointUtils.getEC2DiscoveryUrlsFromZone(dnsName, type);
}
origin: Netflix/eureka

private List<AwsEndpoint> getClusterEndpointsFromConfig() {
  String[] availZones = clientConfig.getAvailabilityZones(clientConfig.getRegion());
  String myZone = InstanceInfo.getZone(availZones, myInstanceInfo);
  Map<String, List<String>> serviceUrls = EndpointUtils
      .getServiceUrlsMapFromConfig(clientConfig, myZone, clientConfig.shouldPreferSameZoneEureka());
  List<AwsEndpoint> endpoints = new ArrayList<>();
  for (String zone : serviceUrls.keySet()) {
    for (String url : serviceUrls.get(zone)) {
      try {
        endpoints.add(new AwsEndpoint(url, getRegion(), zone));
      } catch (Exception ignore) {
        logger.warn("Invalid eureka server URI: {}; removing from the server pool", url);
      }
    }
  }
  logger.debug("Config resolved to {}", endpoints);
  if (endpoints.isEmpty()) {
    logger.error("Cannot resolve to any endpoints from provided configuration: {}", serviceUrls);
  }
  return endpoints;
}
origin: Netflix/eureka

for (String zoneCname : zoneCnamesForRegion) {
  String zone = null;
  if (isEC2Url(zoneCname)) {
    throw new RuntimeException(
        "Cannot find the right DNS entry for "
origin: com.netflix.eureka/eureka-client

/**
 * 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());
}
origin: Netflix/eureka

String region = getRegion(clientConfig);
String[] availZones = clientConfig.getAvailabilityZones(clientConfig.getRegion());
if (availZones == null || availZones.length == 0) {
int myZoneOffset = getZoneOffset(instanceZone, preferSameZone, availZones);
origin: Netflix/eureka

/**
 * @deprecated see replacement in {@link com.netflix.discovery.endpoint.EndpointUtils}
 *
 * Get the list of all eureka service urls from properties file for the eureka client to talk to.
 *
 * @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> getServiceUrlsFromConfig(String instanceZone, boolean preferSameZone) {
  return EndpointUtils.getServiceUrlsFromConfig(clientConfig, instanceZone, preferSameZone);
}
origin: com.netflix.eureka/eureka-client

  @Override
  protected Set<String> getZonesForARegion(String region) {
    Map<String, List<String>> zoneBasedDiscoveryUrlsFromRegion = EndpointUtils
        .getZoneBasedDiscoveryUrlsFromRegion(clientConfig, region);
    if (null != zoneBasedDiscoveryUrlsFromRegion) {
      return zoneBasedDiscoveryUrlsFromRegion.keySet();
    }

    return Collections.emptySet();
  }
}
origin: com.netflix.eureka/eureka-client

/**
 * @deprecated see replacement in {@link com.netflix.discovery.endpoint.EndpointUtils}
 *
 * Get the list of EC2 URLs given the zone name.
 *
 * @param dnsName The dns name of the zone-specific CNAME
 * @param type CNAME or EIP that needs to be retrieved
 * @return The list of EC2 URLs associated with the dns name
 */
@Deprecated
public static Set<String> getEC2DiscoveryUrlsFromZone(String dnsName,
                           EndpointUtils.DiscoveryUrlType type) {
  return EndpointUtils.getEC2DiscoveryUrlsFromZone(dnsName, type);
}
origin: com.netflix.eureka/eureka-client

private List<AwsEndpoint> getClusterEndpointsFromConfig() {
  String[] availZones = clientConfig.getAvailabilityZones(clientConfig.getRegion());
  String myZone = InstanceInfo.getZone(availZones, myInstanceInfo);
  Map<String, List<String>> serviceUrls = EndpointUtils
      .getServiceUrlsMapFromConfig(clientConfig, myZone, clientConfig.shouldPreferSameZoneEureka());
  List<AwsEndpoint> endpoints = new ArrayList<>();
  for (String zone : serviceUrls.keySet()) {
    for (String url : serviceUrls.get(zone)) {
      try {
        endpoints.add(new AwsEndpoint(url, getRegion(), zone));
      } catch (Exception ignore) {
        logger.warn("Invalid eureka server URI: {}; removing from the server pool", url);
      }
    }
  }
  logger.debug("Config resolved to {}", endpoints);
  if (endpoints.isEmpty()) {
    logger.error("Cannot resolve to any endpoints from provided configuration: {}", serviceUrls);
  }
  return endpoints;
}
origin: com.netflix.eureka/eureka-client

for (String zoneCname : zoneCnamesForRegion) {
  String zone = null;
  if (isEC2Url(zoneCname)) {
    throw new RuntimeException(
        "Cannot find the right DNS entry for "
origin: Netflix/eureka

private Collection<String> getIPsForZoneFromDNS(String myZone) {
  return EndpointUtils.getServiceUrlsFromDNS(
      clientConfig,
      myZone,
      true,
      new EndpointUtils.InstanceInfoBasedUrlRandomizer(applicationInfoManager.getInfo())
  );
}
origin: com.netflix.eureka/eureka-client

String region = getRegion(clientConfig);
Map<String, List<String>> zoneDnsNamesMap = getZoneBasedDiscoveryUrlsFromRegion(clientConfig, region);
Set<String> availableZones = zoneDnsNamesMap.keySet();
List<String> zones = new ArrayList<String>(availableZones);
for (String zone : zones) {
  for (String zoneCname : zoneDnsNamesMap.get(zone)) {
    List<String> ec2Urls = new ArrayList<String>(getEC2DiscoveryUrlsFromZone(zoneCname, DiscoveryUrlType.CNAME));
origin: Netflix/eureka

/**
 * Resolve peer URLs.
 *
 * @return peer URLs with node's own URL filtered out
 */
protected List<String> resolvePeerUrls() {
  InstanceInfo myInfo = applicationInfoManager.getInfo();
  String zone = InstanceInfo.getZone(clientConfig.getAvailabilityZones(clientConfig.getRegion()), myInfo);
  List<String> replicaUrls = EndpointUtils
      .getDiscoveryServiceUrls(clientConfig, zone, new EndpointUtils.InstanceInfoBasedUrlRandomizer(myInfo));
  int idx = 0;
  while (idx < replicaUrls.size()) {
    if (isThisMyUrl(replicaUrls.get(idx))) {
      replicaUrls.remove(idx);
    } else {
      idx++;
    }
  }
  return replicaUrls;
}
com.netflix.discovery.endpointEndpointUtils

Javadoc

This class contains some of the utility functions previously found in DiscoveryClient, but should be elsewhere. It *does not yet* clean up the moved code.

Most used methods

  • getDiscoveryServiceUrls
    Get the list of all eureka service urls for the eureka client to talk to.
  • getServiceUrlsFromDNS
    Get the list of all eureka service urls from DNS for the eureka client to talk to. The client picks
  • getEC2DiscoveryUrlsFromZone
    Get the list of EC2 URLs given the zone name.
  • getRegion
    Get the region that this particular instance is in.
  • getServiceUrlsFromConfig
    Get the list of all eureka service urls from properties file for the eureka client to talk to.
  • getServiceUrlsMapFromConfig
    Get the list of all eureka service urls from properties file for the eureka client to talk to.
  • getZoneBasedDiscoveryUrlsFromRegion
    Get the zone based CNAMES that are bound to a region.
  • getZoneOffset
    Gets the zone to pick up for this instance.
  • isEC2Url

Popular in Java

  • Updating database using SQL prepared statement
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • getSharedPreferences (Context)
  • setRequestProperty (URLConnection)
  • System (java.lang)
    Provides access to system-related information and resources including standard input and output. Ena
  • BigInteger (java.math)
    An immutable arbitrary-precision signed integer.FAST CRYPTOGRAPHY This implementation is efficient f
  • NumberFormat (java.text)
    The abstract base class for all number formats. This class provides the interface for formatting and
  • Date (java.util)
    A specific moment in time, with millisecond precision. Values typically come from System#currentTime
  • Hashtable (java.util)
    A plug-in replacement for JDK1.5 java.util.Hashtable. This version is based on org.cliffc.high_scale
  • LinkedList (java.util)
    Doubly-linked list implementation of the List and Dequeinterfaces. Implements all optional list oper
  • Top plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now