From dce0c550119232dfbdc016699a5366ba6050685a Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Wed, 26 Mar 2014 11:10:09 +0100 Subject: [PATCH] Remove cache from DNSUtils Caching of DNS RR should happen on the lowest possible layer, not within Smack: - dnsjava does it's own caching - resolving via the javax API should use the OS's caching (if any) We don't need dozens layers of DNS RR caching. --- .../org/jivesoftware/smack/util/DNSUtil.java | 20 ------------------- 1 file changed, 20 deletions(-) diff --git a/core/src/main/java/org/jivesoftware/smack/util/DNSUtil.java b/core/src/main/java/org/jivesoftware/smack/util/DNSUtil.java index a3d32315a..4430e9bba 100644 --- a/core/src/main/java/org/jivesoftware/smack/util/DNSUtil.java +++ b/core/src/main/java/org/jivesoftware/smack/util/DNSUtil.java @@ -20,7 +20,6 @@ import java.util.ArrayList; import java.util.Collections; import java.util.LinkedList; import java.util.List; -import java.util.Map; import java.util.SortedMap; import java.util.TreeMap; @@ -35,12 +34,6 @@ import org.jivesoftware.smack.util.dns.SRVRecord; */ public class DNSUtil { - /** - * Create a cache to hold the 100 most recently accessed DNS lookups for a period of - * 10 minutes. - */ - private static Map> cache = new Cache>(100, 1000*60*10); - private static DNSResolver dnsResolver = null; /** @@ -116,16 +109,6 @@ public class DNSUtil { } private static List resolveDomain(String domain, char keyPrefix) throws Exception { - // Prefix the key with 's' to distinguish him from the client domain lookups - String key = keyPrefix + domain; - // Return item from cache if it exists. - if (cache.containsKey(key)) { - List addresses = cache.get(key); - if (addresses != null) { - return addresses; - } - } - List addresses = new ArrayList(); // Step one: Do SRV lookups @@ -145,9 +128,6 @@ public class DNSUtil { // Step two: Add the hostname to the end of the list addresses.add(new HostAddress(domain)); - // Add item to cache. - cache.put(key, addresses); - return addresses; }