/** * Iterate only over items with matching name. Returns an list of DNSEntry or null. To retrieve all entries, one must iterate over this linked list. * * @param name * @return list of DNSEntries */ public synchronized Collection<? extends DNSEntry> getDNSEntryList(String name) { return this.get(name != null ? name.toLowerCase() : null); }
private Collection<? extends DNSEntry> _getDNSEntryList(String name) { return this.get(name != null ? name.toLowerCase() : null); }
private Collection<? extends DNSEntry> _getDNSEntryList(String name) { return this.get(name != null ? name.toLowerCase() : null); }
private Collection<? extends DNSEntry> _getDNSEntryList(String name) { return this.get(name != null ? name.toLowerCase() : null); }
/** * Removes a specific entry from the table. Returns true if the entry was found. * * @param dnsEntry * @return true if the entry was removed */ public boolean removeDNSEntry(DNSEntry dnsEntry) { boolean result = false; if (dnsEntry != null) { List<DNSEntry> entryList = this.get(dnsEntry.getKey()); if (entryList != null) { synchronized (entryList) { entryList.remove(dnsEntry); } } } return result; }
/** * Adds an entry to the table. * * @param dnsEntry * @return true if the entry was added */ public boolean addDNSEntry(final DNSEntry dnsEntry) { boolean result = false; if (dnsEntry != null) { List<DNSEntry> entryList = this.get(dnsEntry.getKey()); if (entryList == null) { this.putIfAbsent(dnsEntry.getKey(), new ArrayList<DNSEntry>()); entryList = this.get(dnsEntry.getKey()); } synchronized (entryList) { entryList.add(dnsEntry); } // This is probably not very informative result = true; } return result; }
/** * Replace an existing entry by a new one.<br/> * <b>Note:</b> the 2 entries must have the same key. * * @param newDNSEntry * @param existingDNSEntry * @return <code>true</code> if the entry has been replace, <code>false</code> otherwise. */ public boolean replaceDNSEntry(DNSEntry newDNSEntry, DNSEntry existingDNSEntry) { boolean result = false; if ((newDNSEntry != null) && (existingDNSEntry != null) && (newDNSEntry.getKey().equals(existingDNSEntry.getKey()))) { List<DNSEntry> entryList = this.get(newDNSEntry.getKey()); if (entryList == null) { this.putIfAbsent(newDNSEntry.getKey(), new ArrayList<DNSEntry>()); entryList = this.get(newDNSEntry.getKey()); } synchronized (entryList) { entryList.remove(existingDNSEntry); entryList.add(newDNSEntry); } // This is probably not very informative result = true; } return result; }