Package io.netty.resolver.dns
Class DnsQueryContextManager
- java.lang.Object
-
- io.netty.resolver.dns.DnsQueryContextManager
-
final class DnsQueryContextManager extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
DnsQueryContextManager.DnsQueryContextMap
-
Field Summary
Fields Modifier and Type Field Description private java.util.Map<java.net.InetSocketAddress,DnsQueryContextManager.DnsQueryContextMap>
map
A map whose key is the DNS server address and value is the map of the DNS query ID and its correspondingDnsQueryContext
.
-
Constructor Summary
Constructors Constructor Description DnsQueryContextManager()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) int
add(java.net.InetSocketAddress nameServerAddr, DnsQueryContext qCtx)
AddDnsQueryContext
to the context manager and return the ID that should be used for the query.(package private) DnsQueryContext
get(java.net.InetSocketAddress nameServerAddr, int id)
private DnsQueryContextManager.DnsQueryContextMap
getContextMap(java.net.InetSocketAddress nameServerAddr)
private DnsQueryContextManager.DnsQueryContextMap
getOrCreateContextMap(java.net.InetSocketAddress nameServerAddr)
(package private) DnsQueryContext
remove(java.net.InetSocketAddress nameServerAddr, int id)
private static java.net.Inet6Address
toCompactAddress(java.net.Inet4Address a4)
private static java.net.Inet4Address
toIPv4Address(java.net.Inet6Address a6)
-
-
-
Field Detail
-
map
private final java.util.Map<java.net.InetSocketAddress,DnsQueryContextManager.DnsQueryContextMap> map
A map whose key is the DNS server address and value is the map of the DNS query ID and its correspondingDnsQueryContext
.
-
-
Method Detail
-
add
int add(java.net.InetSocketAddress nameServerAddr, DnsQueryContext qCtx)
AddDnsQueryContext
to the context manager and return the ID that should be used for the query. This method will return-1
if an ID could not be generated and the context was not stored.- Parameters:
nameServerAddr
- TheInetSocketAddress
of the nameserver to query.qCtx
- The {@link {@link DnsQueryContext} to store.- Returns:
- the ID that should be used or
-1
if none could be generated.
-
get
DnsQueryContext get(java.net.InetSocketAddress nameServerAddr, int id)
- Parameters:
nameServerAddr
- TheInetSocketAddress
of the nameserver.id
- The id that identifies theDnsQueryContext
and was used for the query.- Returns:
- The context or
null
if none could be found.
-
remove
DnsQueryContext remove(java.net.InetSocketAddress nameServerAddr, int id)
- Parameters:
nameServerAddr
- TheInetSocketAddress
of the nameserver.id
- The id that identifies theDnsQueryContext
and was used for the query.- Returns:
- The context or
null
if none could be removed.
-
getContextMap
private DnsQueryContextManager.DnsQueryContextMap getContextMap(java.net.InetSocketAddress nameServerAddr)
-
getOrCreateContextMap
private DnsQueryContextManager.DnsQueryContextMap getOrCreateContextMap(java.net.InetSocketAddress nameServerAddr)
-
toCompactAddress
private static java.net.Inet6Address toCompactAddress(java.net.Inet4Address a4)
-
toIPv4Address
private static java.net.Inet4Address toIPv4Address(java.net.Inet6Address a6)
-
-