/** * Get a matching DNS entry from the table. */ public synchronized DNSEntry get(String name, int type, int clazz) { for (CacheNode node = find(name); node != null; node = node.next) { if (node.value.type == type && node.value.clazz == clazz) { return node.value; } } return null; }
/** * Get a matching DNS entry from the table (using equals). * Returns the entry that was found. */ public synchronized DNSEntry get(DNSEntry entry) { for (CacheNode node = find(entry.getName()); node != null; node = node.next) { if (node.value.equals(entry)) { return node.value; } } return null; }
/** * Add a listener for a question. The listener will receive updates * of answers to the question as they arrive, or from the cache if they * are already available. */ void addListener(DNSListener listener, DNSQuestion question) { long now = System.currentTimeMillis(); // add the new listener synchronized (this) { listeners.add(listener); } // report existing matched records if (question != null) { for (DNSCache.CacheNode i = cache.find(question.name); i != null; i = i.next()) { DNSRecord c = (DNSRecord) i.getValue(); if (question.answeredBy(c) && !c.isExpired(now)) { listener.updateRecord(this, now, c); } } } }
for (DNSCache.CacheNode j = cache.find(host.getName().toLowerCase()); j != null; j = j.next())
for (DNSCache.CacheNode j = cache.find(info.getQualifiedName().toLowerCase()); j != null; j = j.next())