org.apache.hadoop.net
Class CachedDNSToSwitchMapping

java.lang.Object
  extended by org.apache.hadoop.net.CachedDNSToSwitchMapping
All Implemented Interfaces:
DNSToSwitchMapping
Direct Known Subclasses:
ScriptBasedMapping

@InterfaceAudience.Public
@InterfaceStability.Evolving
public class CachedDNSToSwitchMapping
extends Object
implements DNSToSwitchMapping

A cached implementation of DNSToSwitchMapping that takes an raw DNSToSwitchMapping and stores the resolved network location in a cache. The following calls to a resolved network location will get its location from the cache.


Field Summary
protected  DNSToSwitchMapping rawMapping
           
 
Constructor Summary
CachedDNSToSwitchMapping(DNSToSwitchMapping rawMapping)
          cache a raw DNS mapping
 
Method Summary
 List<String> resolve(List<String> names)
          Resolves a list of DNS-names/IP-addresses and returns back a list of switch information (network paths).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

rawMapping

protected DNSToSwitchMapping rawMapping
Constructor Detail

CachedDNSToSwitchMapping

public CachedDNSToSwitchMapping(DNSToSwitchMapping rawMapping)
cache a raw DNS mapping

Parameters:
rawMapping - the raw mapping to cache
Method Detail

resolve

public List<String> resolve(List<String> names)
Description copied from interface: DNSToSwitchMapping
Resolves a list of DNS-names/IP-addresses and returns back a list of switch information (network paths). One-to-one correspondence must be maintained between the elements in the lists. Consider an element in the argument list - x.y.com. The switch information that is returned must be a network path of the form /foo/rack, where / is the root, and 'foo' is the switch where 'rack' is connected. Note the hostname/ip-address is not part of the returned path. The network topology of the cluster would determine the number of components in the network path.

Specified by:
resolve in interface DNSToSwitchMapping
Parameters:
names - the list of hosts to resolve (can be empty)
Returns:
list of resolved network paths. If names is empty, the returned list is also empty


Copyright © 2011 Apache Software Foundation. All Rights Reserved.