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 skeletal
AddressResolver implementation.-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractAddressResolver(EventExecutor executor) protectedAbstractAddressResolver(EventExecutor executor, java.lang.Class<? extends T> addressType) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes all the resources allocated and used by this resolver.protected abstract booleandoIsResolved(T address) Invoked byisResolved(SocketAddress)to check if the specifiedaddresshas been resolved already.protected abstract voidInvoked byresolve(SocketAddress)to perform the actual name resolution.protected abstract voiddoResolveAll(T unresolvedAddress, Promise<java.util.List<T>> promise) Invoked byresolveAll(SocketAddress)to perform the actual name resolution.protected EventExecutorexecutor()Returns theEventExecutorwhich is used to notify the listeners of theFuturereturned byresolve(SocketAddress).final booleanisResolved(java.net.SocketAddress address) Returnstrueif and only if the specified address has been resolved.booleanisSupported(java.net.SocketAddress address) Returnstrueif and only if the specified address is supported by this resolved.resolve(java.net.SocketAddress address) Resolves the specified address.Resolves the specified address.resolveAll(java.net.SocketAddress address) Resolves the specified address.resolveAll(java.net.SocketAddress address, Promise<java.util.List<T>> promise) Resolves the specified address.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
executor
-
matcher
-
-
Constructor Details
-
AbstractAddressResolver
- Parameters:
executor- theEventExecutorwhich is used to notify the listeners of theFuturereturned byresolve(SocketAddress)
-
AbstractAddressResolver
- Parameters:
executor- theEventExecutorwhich is used to notify the listeners of theFuturereturned byresolve(SocketAddress)addressType- the type of theSocketAddresssupported by this resolver
-
-
Method Details
-
executor
Returns theEventExecutorwhich is used to notify the listeners of theFuturereturned byresolve(SocketAddress). -
isSupported
public boolean isSupported(java.net.SocketAddress address) Description copied from interface:AddressResolverReturnstrueif and only if the specified address is supported by this resolved.- Specified by:
isSupportedin interfaceAddressResolver<T extends java.net.SocketAddress>
-
isResolved
public final boolean isResolved(java.net.SocketAddress address) Description copied from interface:AddressResolverReturnstrueif and only if the specified address has been resolved.- Specified by:
isResolvedin interfaceAddressResolver<T extends java.net.SocketAddress>
-
doIsResolved
Invoked byisResolved(SocketAddress)to check if the specifiedaddresshas been resolved already. -
resolve
Description copied from interface:AddressResolverResolves the specified address. If the specified address is resolved already, this method does nothing but returning the original address.- Specified by:
resolvein interfaceAddressResolver<T extends java.net.SocketAddress>- Parameters:
address- the address to resolve- Returns:
- the
SocketAddressas the result of the resolution
-
resolve
Description copied from interface:AddressResolverResolves the specified address. If the specified address is resolved already, this method does nothing but returning the original address.- Specified by:
resolvein interfaceAddressResolver<T extends java.net.SocketAddress>- Parameters:
address- the address to resolvepromise- thePromisewhich will be fulfilled when the name resolution is finished- Returns:
- the
SocketAddressas the result of the resolution
-
resolveAll
Description copied from interface:AddressResolverResolves the specified address. If the specified address is resolved already, this method does nothing but returning the original address.- Specified by:
resolveAllin interfaceAddressResolver<T extends java.net.SocketAddress>- Parameters:
address- the address to resolve- Returns:
- the list of the
SocketAddresses 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:AddressResolverResolves the specified address. If the specified address is resolved already, this method does nothing but returning the original address.- Specified by:
resolveAllin interfaceAddressResolver<T extends java.net.SocketAddress>- Parameters:
address- the address to resolvepromise- thePromisewhich will be fulfilled when the name resolution is finished- Returns:
- the list of the
SocketAddresses 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:AddressResolverCloses all the resources allocated and used by this resolver.- Specified by:
closein interfaceAddressResolver<T extends java.net.SocketAddress>- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable
-