Module io.netty5.resolver
Package io.netty5.resolver
Class AbstractAddressResolver<T extends SocketAddress>
- java.lang.Object
-
- io.netty5.resolver.AbstractAddressResolver<T>
-
- All Implemented Interfaces:
AddressResolver<T>
,Closeable
,AutoCloseable
- Direct Known Subclasses:
InetSocketAddressResolver
,NoopAddressResolver
public abstract class AbstractAddressResolver<T extends SocketAddress> extends Object implements AddressResolver<T>
A skeletalAddressResolver
implementation.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractAddressResolver(EventExecutor executor)
protected
AbstractAddressResolver(EventExecutor executor, 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<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(SocketAddress address)
Returnstrue
if and only if the specified address has been resolved.boolean
isSupported(SocketAddress address)
Returnstrue
if and only if the specified address is supported by this resolved.Future<T>
resolve(SocketAddress address)
Resolves the specified address.Future<T>
resolve(SocketAddress address, Promise<T> promise)
Resolves the specified address.Future<List<T>>
resolveAll(SocketAddress address)
Resolves the specified address.Future<List<T>>
resolveAll(SocketAddress address, Promise<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, 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(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 SocketAddress>
-
isResolved
public final boolean isResolved(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 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(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 SocketAddress>
- Parameters:
address
- the address to resolve- Returns:
- the
SocketAddress
as the result of the resolution
-
resolve
public final Future<T> resolve(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 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<List<T>> resolveAll(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 SocketAddress>
- Parameters:
address
- the address to resolve- Returns:
- the list of the
SocketAddress
es as the result of the resolution
-
resolveAll
public final Future<List<T>> resolveAll(SocketAddress address, Promise<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 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 Exception
Invoked byresolve(SocketAddress)
to perform the actual name resolution.- Throws:
Exception
-
doResolveAll
protected abstract void doResolveAll(T unresolvedAddress, Promise<List<T>> promise) throws Exception
Invoked byresolveAll(SocketAddress)
to perform the actual name resolution.- Throws:
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 SocketAddress>
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
-
-