bugfix in Domains - dns-lookup

pull/1/head
Michael Peter Christen 13 years ago
parent cde20911bb
commit 26301a538d

@ -610,14 +610,23 @@ public class Domains {
} }
cacheMiss_Miss++; cacheMiss_Miss++;
// do the dns lookup on the dns server // do the dns lookup on the dns server
//if (!matchesList(host, nameCacheNoCachingPatterns)) System.out.println("DNSLOOKUP " + host); //if (!matchesList(host, nameCacheNoCachingPatterns)) System.out.println("DNSLOOKUP " + host);
try { try {
//final long t = System.currentTimeMillis(); //final long t = System.currentTimeMillis();
ip = InetAddress.getByName(host); //TimeoutRequest.getByName(host, 1000); // this makes the DNS request to backbone Thread.currentThread().setName("Domains: DNS resolve of '" + host + "'"); // thread dump show which host is resolved
ip = TimeoutRequest.getByName(host, 1000); // this makes the DNS request to backbone
//ip = InetAddress.getByName(host); // this makes the DNS request to backbone
//.out.println("DNSLOOKUP-*LOOKUP* " + host + ", time = " + (System.currentTimeMillis() - t) + "ms"); //.out.println("DNSLOOKUP-*LOOKUP* " + host + ", time = " + (System.currentTimeMillis() - t) + "ms");
} catch (final UnknownHostException e) { } catch (final Throwable e) {
// add new entries
NAME_CACHE_MISS.insertIfAbsent(host, PRESENT);
cacheMiss_Insert++;
LOOKUP_SYNC.remove(host);
return null;
}
if (ip == null) {
// add new entries // add new entries
NAME_CACHE_MISS.insertIfAbsent(host, PRESENT); NAME_CACHE_MISS.insertIfAbsent(host, PRESENT);
cacheMiss_Insert++; cacheMiss_Insert++;
@ -625,7 +634,7 @@ public class Domains {
return null; return null;
} }
if (ip != null && !ip.isLoopbackAddress() && !matchesList(host, nameCacheNoCachingPatterns)) { if (!ip.isLoopbackAddress() && !matchesList(host, nameCacheNoCachingPatterns)) {
// add new ip cache entries // add new ip cache entries
NAME_CACHE_HIT.insertIfAbsent(host, ip); NAME_CACHE_HIT.insertIfAbsent(host, ip);
cacheHit_Insert++; cacheHit_Insert++;

Loading…
Cancel
Save