- java.lang.Object
-
- io.netty5.resolver.SimpleNameResolver<InetAddress>
-
- io.netty5.resolver.InetNameResolver
-
- io.netty5.resolver.RoundRobinInetAddressResolver
-
- All Implemented Interfaces:
NameResolver<InetAddress>
,Closeable
,AutoCloseable
public class RoundRobinInetAddressResolver extends InetNameResolver
ANameResolver
that resolvesInetAddress
and force Round Robin by choosing a single address randomly inSimpleNameResolver.resolve(String)
andSimpleNameResolver.resolve(String, Promise)
if multiple are returned by theNameResolver
. UseInetNameResolver.asAddressResolver()
to create aInetSocketAddress
resolver
-
-
Constructor Summary
Constructors Constructor Description RoundRobinInetAddressResolver(EventExecutor executor, NameResolver<InetAddress> nameResolver)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Closes all the resources allocated and used by this resolver.protected void
doResolve(String inetHost, Promise<InetAddress> promise)
Invoked bySimpleNameResolver.resolve(String)
to perform the actual name resolution.protected void
doResolveAll(String inetHost, Promise<List<InetAddress>> promise)
Invoked bySimpleNameResolver.resolveAll(String)
to perform the actual name resolution.-
Methods inherited from class io.netty5.resolver.InetNameResolver
asAddressResolver
-
Methods inherited from class io.netty5.resolver.SimpleNameResolver
executor, resolve, resolve, resolveAll, resolveAll
-
-
-
-
Constructor Detail
-
RoundRobinInetAddressResolver
public RoundRobinInetAddressResolver(EventExecutor executor, NameResolver<InetAddress> nameResolver)
- Parameters:
executor
- theEventExecutor
which is used to notify the listeners of theFuture
returned bySimpleNameResolver.resolve(String)
nameResolver
- theNameResolver
used for name resolution
-
-
Method Detail
-
doResolve
protected void doResolve(String inetHost, Promise<InetAddress> promise) throws Exception
Description copied from class:SimpleNameResolver
Invoked bySimpleNameResolver.resolve(String)
to perform the actual name resolution.- Specified by:
doResolve
in classSimpleNameResolver<InetAddress>
- Throws:
Exception
-
doResolveAll
protected void doResolveAll(String inetHost, Promise<List<InetAddress>> promise) throws Exception
Description copied from class:SimpleNameResolver
Invoked bySimpleNameResolver.resolveAll(String)
to perform the actual name resolution.- Specified by:
doResolveAll
in classSimpleNameResolver<InetAddress>
- Throws:
Exception
-
close
public void close()
Description copied from interface:NameResolver
Closes all the resources allocated and used by this resolver.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceNameResolver<InetAddress>
- Overrides:
close
in classSimpleNameResolver<InetAddress>
-
-