public class DNSCache extends java.util.concurrent.ConcurrentHashMap<java.lang.String,java.util.List<DNSEntry>>
for (Iterator i=dnscache.allValues().iterator(); i.hasNext(); ) {
DNSEntry entry = i.next();
...do something with entry...
}
And here's how to iterate over all entries having a given name:
for (Iterator i=dnscache.getDNSEntryList(name).iterator(); i.hasNext(); ) {
DNSEntry entry = i.next();
...do something with entry...
}
java.util.concurrent.ConcurrentHashMap.KeySetView<K,V>| 构造器和说明 |
|---|
DNSCache() |
DNSCache(DNSCache map) |
DNSCache(int initialCapacity)
Create a table with a given initial size.
|
| 限定符和类型 | 方法和说明 |
|---|---|
boolean |
addDNSEntry(DNSEntry dnsEntry)
Adds an entry to the table.
|
java.util.Collection<DNSEntry> |
allValues()
Returns all entries in the cache
|
protected java.lang.Object |
clone() |
DNSEntry |
getDNSEntry(DNSEntry dnsEntry)
Get a matching DNS entry from the table (using isSameEntry).
|
DNSEntry |
getDNSEntry(java.lang.String name,
DNSRecordType type,
DNSRecordClass recordClass)
Get a matching DNS entry from the table.
|
java.util.Collection<? extends DNSEntry> |
getDNSEntryList(java.lang.String name)
Iterate only over items with matching name.
|
java.util.Collection<? extends DNSEntry> |
getDNSEntryList(java.lang.String name,
DNSRecordType type,
DNSRecordClass recordClass)
Get all matching DNS entries from the table.
|
void |
logCachedContent()
Prints the content of the cache to the
logger. |
boolean |
removeDNSEntry(DNSEntry dnsEntry)
Removes a specific entry from the table.
|
boolean |
replaceDNSEntry(DNSEntry newDNSEntry,
DNSEntry existingDNSEntry)
Replace an existing entry by a new one.
|
java.lang.String |
toString() |
clear, compute, computeIfAbsent, computeIfPresent, contains, containsKey, containsValue, elements, entrySet, equals, forEach, forEach, forEach, forEachEntry, forEachEntry, forEachKey, forEachKey, forEachValue, forEachValue, get, getOrDefault, hashCode, isEmpty, keys, keySet, keySet, mappingCount, merge, newKeySet, newKeySet, put, putAll, putIfAbsent, reduce, reduceEntries, reduceEntries, reduceEntriesToDouble, reduceEntriesToInt, reduceEntriesToLong, reduceKeys, reduceKeys, reduceKeysToDouble, reduceKeysToInt, reduceKeysToLong, reduceToDouble, reduceToInt, reduceToLong, reduceValues, reduceValues, reduceValuesToDouble, reduceValuesToInt, reduceValuesToLong, remove, remove, replace, replace, replaceAll, search, searchEntries, searchKeys, searchValues, size, valuespublic DNSCache()
public DNSCache(DNSCache map)
map - public DNSCache(int initialCapacity)
initialCapacity - protected java.lang.Object clone()
throws java.lang.CloneNotSupportedException
clone 在类中 java.util.AbstractMap<java.lang.String,java.util.List<DNSEntry>>java.lang.CloneNotSupportedExceptionpublic java.util.Collection<DNSEntry> allValues()
public java.util.Collection<? extends DNSEntry> getDNSEntryList(java.lang.String name)
name - public DNSEntry getDNSEntry(DNSEntry dnsEntry)
dnsEntry - public DNSEntry getDNSEntry(java.lang.String name, DNSRecordType type, DNSRecordClass recordClass)
name - type - recordClass - public java.util.Collection<? extends DNSEntry> getDNSEntryList(java.lang.String name, DNSRecordType type, DNSRecordClass recordClass)
name - type - recordClass - public boolean addDNSEntry(DNSEntry dnsEntry)
dnsEntry - public boolean removeDNSEntry(DNSEntry dnsEntry)
dnsEntry - public boolean replaceDNSEntry(DNSEntry newDNSEntry, DNSEntry existingDNSEntry)
newDNSEntry - existingDNSEntry - true if the entry has been replace, false otherwise.public java.lang.String toString()
toString 在类中 java.util.concurrent.ConcurrentHashMap<java.lang.String,java.util.List<DNSEntry>>public void logCachedContent()
logger.