Search in sources :

Example 1 with CachedDNSToSwitchMapping

use of org.apache.hadoop.net.CachedDNSToSwitchMapping in project hadoop by apache.

the class RackResolver method init.

public static synchronized void init(Configuration conf) {
    if (initCalled) {
        return;
    } else {
        initCalled = true;
    }
    Class<? extends DNSToSwitchMapping> dnsToSwitchMappingClass = conf.getClass(CommonConfigurationKeysPublic.NET_TOPOLOGY_NODE_SWITCH_MAPPING_IMPL_KEY, ScriptBasedMapping.class, DNSToSwitchMapping.class);
    try {
        DNSToSwitchMapping newInstance = ReflectionUtils.newInstance(dnsToSwitchMappingClass, conf);
        // Wrap around the configured class with the Cached implementation so as
        // to save on repetitive lookups.
        // Check if the impl is already caching, to avoid double caching.
        dnsToSwitchMapping = ((newInstance instanceof CachedDNSToSwitchMapping) ? newInstance : new CachedDNSToSwitchMapping(newInstance));
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
Also used : DNSToSwitchMapping(org.apache.hadoop.net.DNSToSwitchMapping) CachedDNSToSwitchMapping(org.apache.hadoop.net.CachedDNSToSwitchMapping) CachedDNSToSwitchMapping(org.apache.hadoop.net.CachedDNSToSwitchMapping)

Aggregations

CachedDNSToSwitchMapping (org.apache.hadoop.net.CachedDNSToSwitchMapping)1 DNSToSwitchMapping (org.apache.hadoop.net.DNSToSwitchMapping)1