Top Description Fields Constructors Methods
io.netty.resolver.dns

public Class DefaultAuthoritativeDnsServerCache

extends Object
implements AuthoritativeDnsServerCache
Class Inheritance
All Implemented Interfaces
io.netty.resolver.dns.AuthoritativeDnsServerCache
Imports
io.netty.channel.EventLoop, io.netty.util.internal.PlatformDependent, java.net.InetSocketAddress, java.util.Collections, .Comparator, .List, java.util.concurrent.ConcurrentMap

Default implementation of AuthoritativeDnsServerCache, backed by a ConcurrentMap.

Field Summary

Modifier and TypeField and Description
private final Comparator<InetSocketAddress>
private final int
private final int
private final Cache<InetSocketAddress>

Constructor Summary

AccessConstructor and Description
public
DefaultAuthoritativeDnsServerCache()

Create a cache that respects the TTL returned by the DNS server.

public
DefaultAuthoritativeDnsServerCache(int
the minimum TTL
minTtl
,
int
the maximum TTL
maxTtl
,
Comparator<InetSocketAddress>
the Comparator to order the InetSocketAddress for a hostname or null if insertion order should be used.
comparator
)

Create a cache.

Method Summary

Modifier and TypeMethod and Description
public void
cache(String
the hostname
hostname
,
InetSocketAddress
the nameserver address (which may be unresolved).
address
,
long
the TTL as returned by the DNS server
originalTtl
,
EventLoop
the EventLoop used to register the TTL timeout
loop
)

Implements io.netty.resolver.dns.AuthoritativeDnsServerCache.cache.

Caches a nameserver that should be used to resolve the given hostname.
public void
clear()

Implements io.netty.resolver.dns.AuthoritativeDnsServerCache.clear.

Clears all cached nameservers.
public boolean
clear(String hostname)

Implements io.netty.resolver.dns.AuthoritativeDnsServerCache.clear.

Clears the cached nameservers for the specified hostname.
public DnsServerAddressStream
get(String
the hostname
hostname
)

Implements io.netty.resolver.dns.AuthoritativeDnsServerCache.get.

Returns the cached nameservers that should be used to resolve the given hostname.
pack-priv int
pack-priv int
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

comparatorback to summary
private final Comparator<InetSocketAddress> comparator
maxTtlback to summary
private final int maxTtl
minTtlback to summary
private final int minTtl
resolveCacheback to summary
private final Cache<InetSocketAddress> resolveCache

Constructor Detail

DefaultAuthoritativeDnsServerCacheback to summary
public DefaultAuthoritativeDnsServerCache()

Create a cache that respects the TTL returned by the DNS server.

DefaultAuthoritativeDnsServerCacheback to summary
public DefaultAuthoritativeDnsServerCache(int minTtl, int maxTtl, Comparator<InetSocketAddress> comparator)

Create a cache.

Parameters
minTtl:int

the minimum TTL

maxTtl:int

the maximum TTL

comparator:Comparator<InetSocketAddress>

the Comparator to order the InetSocketAddress for a hostname or null if insertion order should be used.

Method Detail

cacheback to summary
public void cache(String hostname, InetSocketAddress address, long originalTtl, EventLoop loop)

Implements io.netty.resolver.dns.AuthoritativeDnsServerCache.cache.

Doc from io.netty.resolver.dns.AuthoritativeDnsServerCache.cache.

Caches a nameserver that should be used to resolve the given hostname.

Parameters
hostname:String

the hostname

address:InetSocketAddress

the nameserver address (which may be unresolved).

originalTtl:long

the TTL as returned by the DNS server

loop:EventLoop

the EventLoop used to register the TTL timeout

Annotations
@Override
clearback to summary
public void clear()

Implements io.netty.resolver.dns.AuthoritativeDnsServerCache.clear.

Doc from io.netty.resolver.dns.AuthoritativeDnsServerCache.clear.

Clears all cached nameservers.

Annotations
@Override
clearback to summary
public boolean clear(String hostname)

Implements io.netty.resolver.dns.AuthoritativeDnsServerCache.clear.

Doc from io.netty.resolver.dns.AuthoritativeDnsServerCache.clear.

Clears the cached nameservers for the specified hostname.

Returns:boolean

true if and only if there was an entry for the specified host name in the cache and it has been removed by this method

Annotations
@Override
getback to summary
public DnsServerAddressStream get(String hostname)

Implements io.netty.resolver.dns.AuthoritativeDnsServerCache.get.

Doc from io.netty.resolver.dns.AuthoritativeDnsServerCache.get.

Returns the cached nameservers that should be used to resolve the given hostname. The returned DnsServerAddressStream may contain unresolved InetSocketAddresses that will be resolved when needed while resolving other domain names.

Parameters
hostname:String

the hostname

Returns:DnsServerAddressStream

the cached entries or an null if none.

Annotations
@SuppressWarnings:unchecked
@Override
maxTtlback to summary
pack-priv int maxTtl()
minTtlback to summary
pack-priv int minTtl()
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override