@Override public List<String> resolve(List<String> names) { // normalize all input names to be in the form of IP addresses names = NetUtils.normalizeHostNames(names); List <String> result = new ArrayList<String>(names.size()); if (names.isEmpty()) { return result; } List<String> uncachedHosts = getUncachedHosts(names); // Resolve the uncached hosts List<String> resolvedHosts = rawMapping.resolve(uncachedHosts); //cache them cacheResolvedHosts(uncachedHosts, resolvedHosts); //now look up the entire list in the cache return getCachedHosts(names); }
public List<String> resolve(List<String> names) { names = NetUtils.normalizeHostNames(names);
public List<String> resolve(List<String> names) { names = NetUtils.normalizeHostNames(names);
@Override public List<String> resolve(List<String> names) { // normalize all input names to be in the form of IP addresses names = NetUtils.normalizeHostNames(names); List <String> result = new ArrayList<String>(names.size()); if (names.isEmpty()) { return result; } List<String> uncachedHosts = getUncachedHosts(names); // Resolve the uncached hosts List<String> resolvedHosts = rawMapping.resolve(uncachedHosts); //cache them cacheResolvedHosts(uncachedHosts, resolvedHosts); //now look up the entire list in the cache return getCachedHosts(names); }
@Override public List<String> resolve(List<String> names) { // normalize all input names to be in the form of IP addresses names = NetUtils.normalizeHostNames(names); List <String> result = new ArrayList<String>(names.size()); if (names.isEmpty()) { return result; } List<String> uncachedHosts = getUncachedHosts(names); // Resolve the uncached hosts List<String> resolvedHosts = rawMapping.resolve(uncachedHosts); //cache them cacheResolvedHosts(uncachedHosts, resolvedHosts); //now look up the entire list in the cache return getCachedHosts(names); }
@Override public List<String> resolve(List<String> names) { // normalize all input names to be in the form of IP addresses names = NetUtils.normalizeHostNames(names); List <String> result = new ArrayList<String>(names.size()); if (names.isEmpty()) { return result; } List<String> uncachedHosts = getUncachedHosts(names); // Resolve the uncached hosts List<String> resolvedHosts = rawMapping.resolve(uncachedHosts); //cache them cacheResolvedHosts(uncachedHosts, resolvedHosts); //now look up the entire list in the cache return getCachedHosts(names); }
@Override public List<String> resolve(List<String> names) { // normalize all input names to be in the form of IP addresses names = NetUtils.normalizeHostNames(names); List <String> result = new ArrayList<String>(names.size()); if (names.isEmpty()) { return result; } List<String> uncachedHosts = getUncachedHosts(names); // Resolve the uncached hosts List<String> resolvedHosts = rawMapping.resolve(uncachedHosts); //cache them cacheResolvedHosts(uncachedHosts, resolvedHosts); //now look up the entire list in the cache return getCachedHosts(names); }
/** * Test for {@link NetUtils#normalizeHostNames} */ @Test public void testNormalizeHostName() { List<String> hosts = Arrays.asList(new String[] {"127.0.0.1", "localhost", "1.kanyezone.appspot.com", "UnknownHost123"}); List<String> normalizedHosts = NetUtils.normalizeHostNames(hosts); // when ipaddress is normalized, same address is expected in return assertEquals(normalizedHosts.get(0), hosts.get(0)); // for normalizing a resolvable hostname, resolved ipaddress is expected in return assertFalse(normalizedHosts.get(1).equals(hosts.get(1))); assertEquals(normalizedHosts.get(1), hosts.get(0)); // this address HADOOP-8372: when normalizing a valid resolvable hostname start with numeric, // its ipaddress is expected to return assertFalse(normalizedHosts.get(2).equals(hosts.get(2))); // return the same hostname after normalizing a irresolvable hostname. assertEquals(normalizedHosts.get(3), hosts.get(3)); }
/** * Test for {@link NetUtils#normalizeHostNames} */ @Test public void testNormalizeHostName() { List<String> hosts = Arrays.asList(new String[] {"127.0.0.1", "localhost", "1.kanyezone.appspot.com", "UnknownHost123"}); List<String> normalizedHosts = NetUtils.normalizeHostNames(hosts); // when ipaddress is normalized, same address is expected in return assertEquals(normalizedHosts.get(0), hosts.get(0)); // for normalizing a resolvable hostname, resolved ipaddress is expected in return assertFalse(normalizedHosts.get(1).equals(hosts.get(1))); assertEquals(normalizedHosts.get(1), hosts.get(0)); // this address HADOOP-8372: when normalizing a valid resolvable hostname start with numeric, // its ipaddress is expected to return assertFalse(normalizedHosts.get(2).equals(hosts.get(2))); // return the same hostname after normalizing a irresolvable hostname. assertEquals(normalizedHosts.get(3), hosts.get(3)); }