/** * 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; }
/** * Adds an entry to the table. */ public synchronized void add(final DNSEntry entry) { //logger.log("DNSCache.add("+entry.getName()+")"); CacheNode newValue = new CacheNode(entry); CacheNode node = (CacheNode) hashtable.get(entry.getName()); if (node == null) { hashtable.put(entry.getName(), newValue); } else { newValue.next = node.next; node.next = newValue; } size++; }
/** * True if this record is the same as some other record. */ boolean sameAs(DNSRecord other) { return super.equals(other) && sameValue((DNSRecord) other); }