Top Description Fields Constructors Methods
io.netty.resolver

public final Class DefaultHostsFileEntriesResolver

extends Object
implements HostsFileEntriesResolver
Class Inheritance
All Implemented Interfaces
io.netty.resolver.HostsFileEntriesResolver
Imports
io.netty.util.CharsetUtil, io.netty.util.internal.ObjectUtil, .PlatformDependent, .SystemPropertyUtil, io.netty.util.internal.logging.InternalLogger, .InternalLoggerFactory, java.net.InetAddress, java.nio.charset.Charset, java.util.ArrayList, .List, .Locale, .Map, java.util.concurrent.atomic.AtomicLong

Default HostsFileEntriesResolver that resolves hosts file entries only once.

Field Summary

Modifier and TypeField and Description
private static final long
private final HostsFileEntriesProvider.Parser
private volatile Map<String, List<InetAddress>>
private volatile Map<String, List<InetAddress>>
private final AtomicLong
private static final InternalLogger
private final long

Constructor Summary

AccessConstructor and Description
public
pack-priv
DefaultHostsFileEntriesResolver(HostsFileEntriesProvider.Parser hostsFileParser, long refreshInterval)

Method Summary

Modifier and TypeMethod and Description
public InetAddress
address(String
the hostname to resolve
inetHost
,
ResolvedAddressTypes
the address types to resolve
resolvedAddressTypes
)

Implements io.netty.resolver.HostsFileEntriesResolver.address.

Resolve the address of a hostname against the entries in a hosts file, depending on some address types.
public List<InetAddress>

Returns:

all matching addresses or null in case the hostname cannot be resolved
addresses
(String
the hostname to resolve
inetHost
,
ResolvedAddressTypes
the address types to resolve
resolvedAddressTypes
)

Resolves all addresses of a hostname against the entries in a hosts file, depending on the specified ResolvedAddressTypes.

private static List<InetAddress>
private void
private static InetAddress
pack-priv String
normalize(String inetHost)

private static HostsFileEntriesProvider
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

DEFAULT_REFRESH_INTERVALback to summary
private static final long DEFAULT_REFRESH_INTERVAL
hostsFileParserback to summary
private final HostsFileEntriesProvider.Parser hostsFileParser
inet4Entriesback to summary
private volatile Map<String, List<InetAddress>> inet4Entries
inet6Entriesback to summary
private volatile Map<String, List<InetAddress>> inet6Entries
lastRefreshback to summary
private final AtomicLong lastRefresh
loggerback to summary
private static final InternalLogger logger
refreshIntervalback to summary
private final long refreshInterval

Constructor Detail

DefaultHostsFileEntriesResolverback to summary
public DefaultHostsFileEntriesResolver()
DefaultHostsFileEntriesResolverback to summary
pack-priv DefaultHostsFileEntriesResolver(HostsFileEntriesProvider.Parser hostsFileParser, long refreshInterval)

Method Detail

addressback to summary
public InetAddress address(String inetHost, ResolvedAddressTypes resolvedAddressTypes)

Implements io.netty.resolver.HostsFileEntriesResolver.address.

Doc from io.netty.resolver.HostsFileEntriesResolver.address.

Resolve the address of a hostname against the entries in a hosts file, depending on some address types.

Parameters
inetHost:String

the hostname to resolve

resolvedAddressTypes:ResolvedAddressTypes

the address types to resolve

Returns:InetAddress

the first matching address

Annotations
@Override
addressesback to summary
public List<InetAddress> addresses(String inetHost, ResolvedAddressTypes resolvedAddressTypes)

Resolves all addresses of a hostname against the entries in a hosts file, depending on the specified ResolvedAddressTypes.

Parameters
inetHost:String

the hostname to resolve

resolvedAddressTypes:ResolvedAddressTypes

the address types to resolve

Returns:List<InetAddress>

all matching addresses or null in case the hostname cannot be resolved

allAddressesback to summary
private static List<InetAddress> allAddresses(List<InetAddress> a, List<InetAddress> b)
ensureHostsFileEntriesAreFreshback to summary
private void ensureHostsFileEntriesAreFresh()
firstAddressback to summary
private static InetAddress firstAddress(List<InetAddress> addresses)
normalizeback to summary
pack-priv String normalize(String inetHost)
parseEntriesback to summary
private static HostsFileEntriesProvider parseEntries(HostsFileEntriesProvider.Parser parser)