Class DnsNameResolver
java.lang.Object
io.grpc.NameResolver
io.grpc.internal.DnsNameResolver
A DNS-based
NameResolver.
Each A or AAAA record emits an EquivalentAddressGroup in the list
passed to NameResolver.Listener2.onResult2(ResolutionResult).
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceAddressResolver resolves a hostname into a list of addresses.protected static final classUsed as a DNS-based name resolver's internal representation of resolution result.static interfaceDnsNameResolver.ResourceResolveris a Dns ResourceRecord resolver.static final classDescribes a parsed SRV record.Nested classes/interfaces inherited from class NameResolver
NameResolver.Args, NameResolver.ConfigOrError, NameResolver.Factory, NameResolver.Listener, NameResolver.Listener2, NameResolver.ResolutionResult, NameResolver.ResolutionResultAttr, NameResolver.ServiceConfigParser -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected DnsNameResolver.AddressResolverprotected static booleanprotected boolean -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedDnsNameResolver(String nsAuthority, String name, NameResolver.Args args, SharedResourceHolder.Resource<Executor> executorResource, com.google.common.base.Stopwatch stopwatch, boolean isAndroid) -
Method Summary
Modifier and TypeMethodDescriptionprotected DnsNameResolver.InternalResolutionResultdoResolve(boolean forceTxt) Main logic of name resolution.protected StringgetHost()protected DnsNameResolver.ResourceResolverReturns the authority used to authenticate connections to servers.voidrefresh()Re-resolve the name.protected voidsetAddressResolver(DnsNameResolver.AddressResolver addressResolver) protected voidsetResourceResolver(DnsNameResolver.ResourceResolver resourceResolver) protected static booleanshouldUseJndi(boolean jndiEnabled, boolean jndiLocalhostEnabled, String target) voidshutdown()Stops the resolution.voidstart(NameResolver.Listener2 listener) Starts the resolution.Methods inherited from class NameResolver
start
-
Field Details
-
enableTxt
protected static boolean enableTxt -
addressResolver
-
resolved
protected boolean resolved
-
-
Constructor Details
-
Method Details
-
getServiceAuthority
Description copied from class:NameResolverReturns the authority used to authenticate connections to servers. It must be from a trusted source, because if the authority is tampered with, RPCs may be sent to the attackers which may leak sensitive user data.An implementation must generate it without blocking, typically in line, and must keep it unchanged.
NameResolvers created from the same factory with the same argument must return the same authority.- Specified by:
getServiceAuthorityin classNameResolver
-
getHost
-
start
Description copied from class:NameResolverStarts the resolution. The method is not supposed to throw any exceptions. That might cause the Channel that the name resolver is serving to crash. Errors should be propagated throughNameResolver.Listener2.onError(Status).An instance may not be started more than once, by any overload of this method, even after an intervening call to
NameResolver.shutdown().- Overrides:
startin classNameResolver- Parameters:
listener- used to receive updates on the target
-
refresh
public void refresh()Description copied from class:NameResolverRe-resolve the name.Can only be called after
NameResolver.start(NameResolver.Listener)has been called.This is only a hint. Implementation takes it as a signal but may not start resolution immediately. It should never throw.
The default implementation is no-op.
- Overrides:
refreshin classNameResolver
-
doResolve
Main logic of name resolution. -
shutdown
public void shutdown()Description copied from class:NameResolverStops the resolution. Updates to the Listener will stop.- Specified by:
shutdownin classNameResolver
-
setAddressResolver
-
setResourceResolver
-
getResourceResolver
-
shouldUseJndi
protected static boolean shouldUseJndi(boolean jndiEnabled, boolean jndiLocalhostEnabled, String target)
-