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 skeletalAddressResolverimplementation.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractAddressResolver(EventExecutor executor)protectedAbstractAddressResolver(EventExecutor executor, Class<? extends T> addressType)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidclose()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 voiddoResolve(T unresolvedAddress, Promise<T> promise)Invoked byresolve(SocketAddress)to perform the actual name resolution.protected abstract voiddoResolveAll(T unresolvedAddress, Promise<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).booleanisResolved(SocketAddress address)Returnstrueif and only if the specified address has been resolved.booleanisSupported(SocketAddress address)Returnstrueif 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- theEventExecutorwhich is used to notify the listeners of theFuturereturned byresolve(SocketAddress)
-
AbstractAddressResolver
protected AbstractAddressResolver(EventExecutor executor, Class<? extends T> addressType)
- Parameters:
executor- theEventExecutorwhich is used to notify the listeners of theFuturereturned byresolve(SocketAddress)addressType- the type of theSocketAddresssupported by this resolver
-
-
Method Detail
-
executor
protected EventExecutor executor()
Returns theEventExecutorwhich is used to notify the listeners of theFuturereturned byresolve(SocketAddress).
-
isSupported
public boolean isSupported(SocketAddress address)
Description copied from interface:AddressResolverReturnstrueif and only if the specified address is supported by this resolved.- Specified by:
isSupportedin interfaceAddressResolver<T extends SocketAddress>
-
isResolved
public final boolean isResolved(SocketAddress address)
Description copied from interface:AddressResolverReturnstrueif and only if the specified address has been resolved.- Specified by:
isResolvedin interfaceAddressResolver<T extends SocketAddress>
-
doIsResolved
protected abstract boolean doIsResolved(T address)
Invoked byisResolved(SocketAddress)to check if the specifiedaddresshas been resolved already.
-
resolve
public final Future<T> resolve(SocketAddress address)
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 SocketAddress>- Parameters:
address- the address to resolve- Returns:
- the
SocketAddressas the result of the resolution
-
resolve
public final Future<T> resolve(SocketAddress address, Promise<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:
resolvein interfaceAddressResolver<T extends 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
public final Future<List<T>> resolveAll(SocketAddress address)
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 SocketAddress>- Parameters:
address- the address to resolve- Returns:
- the list of the
SocketAddresses as the result of the resolution
-
resolveAll
public final Future<List<T>> resolveAll(SocketAddress address, Promise<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 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 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:AddressResolverCloses all the resources allocated and used by this resolver.- Specified by:
closein interfaceAddressResolver<T extends SocketAddress>- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-
-