Exemple #1
0
        public override IList <string> Resolve(IList <string> names)
        {
            // normalize all input names to be in the form of IP addresses
            names = NetUtils.NormalizeHostNames(names);
            IList <string> result = new AList <string>(names.Count);

            if (names.IsEmpty())
            {
                return(result);
            }
            IList <string> uncachedHosts = GetUncachedHosts(names);
            // Resolve the uncached hosts
            IList <string> resolvedHosts = rawMapping.Resolve(uncachedHosts);

            //cache them
            CacheResolvedHosts(uncachedHosts, resolvedHosts);
            //now look up the entire list in the cache
            return(GetCachedHosts(names));
        }
Exemple #2
0
        private static Node CoreResolve(string hostName)
        {
            IList <string> tmpList = new AList <string>(1);

            tmpList.AddItem(hostName);
            IList <string> rNameList = dnsToSwitchMapping.Resolve(tmpList);
            string         rName     = null;

            if (rNameList == null || rNameList[0] == null)
            {
                rName = NetworkTopology.DefaultRack;
                Log.Info("Couldn't resolve " + hostName + ". Falling back to " + NetworkTopology.
                         DefaultRack);
            }
            else
            {
                rName = rNameList[0];
                Log.Info("Resolved " + hostName + " to " + rName);
            }
            return(new NodeBase(hostName, rName));
        }