Package io.netty.resolver
Class AbstractAddressResolver<T extends java.net.SocketAddress>
- java.lang.Object
-
- io.netty.resolver.AbstractAddressResolver<T>
-
- All Implemented Interfaces:
AddressResolver<T>
,java.io.Closeable
,java.lang.AutoCloseable
- Direct Known Subclasses:
InetSocketAddressResolver
,NoopAddressResolver
public abstract class AbstractAddressResolver<T extends java.net.SocketAddress> extends java.lang.Object implements AddressResolver<T>
A skeletalAddressResolver
implementation.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractAddressResolver(EventExecutor executor)
protected
AbstractAddressResolver(EventExecutor executor, java.lang.Class<? extends T> addressType)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
close()
Closes all the resources allocated and used by this resolver.protected abstract boolean
doIsResolved(T address)
Invoked byisResolved(SocketAddress)
to check if the specifiedaddress
has been resolved already.protected abstract void
doResolve(T unresolvedAddress, Promise<T> promise)
Invoked byresolve(SocketAddress)
to perform the actual name resolution.protected abstract void
doResolveAll(T unresolvedAddress, Promise<java.util.List<T>> promise)
Invoked byresolveAll(SocketAddress)
to perform the actual name resolution.protected EventExecutor
executor()
Returns theEventExecutor
which is used to notify the listeners of theFuture
returned byresolve(SocketAddress)
.boolean
isResolved(java.net.SocketAddress address)
Returnstrue
if and only if the specified address has been resolved.boolean
isSupported(java.net.SocketAddress address)
Returnstrue
if and only if the specified address is supported by this resolved.Future<T>
resolve(java.net.SocketAddress address)
Resolves the specified address.Future<T>
resolve(java.net.SocketAddress address, Promise<T> promise)
Resolves the specified address.Future<java.util.List<T>>
resolveAll(java.net.SocketAddress address)
Resolves the specified address.Future<java.util.List<T>>
resolveAll(java.net.SocketAddress address, Promise<java.util.List<T>> promise)
Resolves the specified address.
-
-
-
Constructor Detail
-
AbstractAddressResolver
protected AbstractAddressResolver(EventExecutor executor)
- Parameters:
executor
- theEventExecutor
which is used to notify the listeners of theFuture
returned byresolve(SocketAddress)
-
AbstractAddressResolver
protected AbstractAddressResolver(EventExecutor executor, java.lang.Class<? extends T> addressType)
- Parameters:
executor
- theEventExecutor
which is used to notify the listeners of theFuture
returned byresolve(SocketAddress)
addressType
- the type of theSocketAddress
supported by this resolver
-
-
Method Detail
-
executor
protected EventExecutor executor()
Returns theEventExecutor
which is used to notify the listeners of theFuture
returned byresolve(SocketAddress)
.
-
isSupported
public boolean isSupported(java.net.SocketAddress address)
Description copied from interface:AddressResolver
Returnstrue
if and only if the specified address is supported by this resolved.- Specified by:
isSupported
in interfaceAddressResolver<T extends java.net.SocketAddress>
-
isResolved
public final boolean isResolved(java.net.SocketAddress address)
Description copied from interface:AddressResolver
Returnstrue
if and only if the specified address has been resolved.- Specified by:
isResolved
in interfaceAddressResolver<T extends java.net.SocketAddress>
-
doIsResolved
protected abstract boolean doIsResolved(T address)
Invoked byisResolved(SocketAddress)
to check if the specifiedaddress
has been resolved already.
-
resolve
public final Future<T> resolve(java.net.SocketAddress address)
Description copied from interface:AddressResolver
Resolves the specified address. If the specified address is resolved already, this method does nothing but returning the original address.- Specified by:
resolve
in interfaceAddressResolver<T extends java.net.SocketAddress>
- Parameters:
address
- the address to resolve- Returns:
- the
SocketAddress
as the result of the resolution
-
resolve
public final Future<T> resolve(java.net.SocketAddress address, Promise<T> promise)
Description copied from interface:AddressResolver
Resolves the specified address. If the specified address is resolved already, this method does nothing but returning the original address.- Specified by:
resolve
in interfaceAddressResolver<T extends java.net.SocketAddress>
- Parameters:
address
- the address to resolvepromise
- thePromise
which will be fulfilled when the name resolution is finished- Returns:
- the
SocketAddress
as the result of the resolution
-
resolveAll
public final Future<java.util.List<T>> resolveAll(java.net.SocketAddress address)
Description copied from interface:AddressResolver
Resolves the specified address. If the specified address is resolved already, this method does nothing but returning the original address.- Specified by:
resolveAll
in interfaceAddressResolver<T extends java.net.SocketAddress>
- Parameters:
address
- the address to resolve- Returns:
- the list of the
SocketAddress
es as the result of the resolution
-
resolveAll
public final Future<java.util.List<T>> resolveAll(java.net.SocketAddress address, Promise<java.util.List<T>> promise)
Description copied from interface:AddressResolver
Resolves the specified address. If the specified address is resolved already, this method does nothing but returning the original address.- Specified by:
resolveAll
in interfaceAddressResolver<T extends java.net.SocketAddress>
- Parameters:
address
- the address to resolvepromise
- thePromise
which will be fulfilled when the name resolution is finished- Returns:
- the list of the
SocketAddress
es as the result of the resolution
-
doResolve
protected abstract void doResolve(T unresolvedAddress, Promise<T> promise) throws java.lang.Exception
Invoked byresolve(SocketAddress)
to perform the actual name resolution.- Throws:
java.lang.Exception
-
doResolveAll
protected abstract void doResolveAll(T unresolvedAddress, Promise<java.util.List<T>> promise) throws java.lang.Exception
Invoked byresolveAll(SocketAddress)
to perform the actual name resolution.- Throws:
java.lang.Exception
-
close
public void close()
Description copied from interface:AddressResolver
Closes all the resources allocated and used by this resolver.- Specified by:
close
in interfaceAddressResolver<T extends java.net.SocketAddress>
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
-
-