Package io.grpc.internal
Class DnsNameResolverProvider
- java.lang.Object
-
- io.grpc.NameResolver.Factory
-
- io.grpc.NameResolverProvider
-
- io.grpc.internal.DnsNameResolverProvider
-
public final class DnsNameResolverProvider extends NameResolverProvider
A provider forDnsNameResolver.It resolves a target URI whose scheme is
"dns". The (optional) authority of the target URI is reserved for the address of alternative DNS server (not implemented yet). The path of the target URI, excluding the leading slash'/', is treated as the host name and the optional port to be resolved by DNS. Example target URIs:"dns:///foo.googleapis.com:8080"(using default DNS)"dns://8.8.8.8/foo.googleapis.com:8080"(using alternative DNS (not implemented yet))"dns:///foo.googleapis.com"(without port)
-
-
Field Summary
Fields Modifier and Type Field Description private static booleanIS_ANDROIDprivate static java.lang.StringSCHEME
-
Constructor Summary
Constructors Constructor Description DnsNameResolverProvider()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetDefaultScheme()Returns the default scheme, which will be used to construct a URI whenManagedChannelBuilder.forTarget(String)is given an authority string instead of a compliant URI.java.util.Collection<java.lang.Class<? extends java.net.SocketAddress>>getProducedSocketAddressTypes()Returns theSocketAddresstypes this provider's name-resolver is capable of producing.protected booleanisAvailable()Whether this provider is available for use, taking the current environment into consideration.NameResolvernewNameResolver(java.net.URI targetUri, NameResolver.Args args)Creates aNameResolverfor the given target URI, ornullif the given URI cannot be resolved by this factory.intpriority()A priority, from 0 to 10 that this provider should be used, taking the current environment into consideration.-
Methods inherited from class io.grpc.NameResolverProvider
getScheme
-
-
-
-
Field Detail
-
SCHEME
private static final java.lang.String SCHEME
- See Also:
- Constant Field Values
-
IS_ANDROID
private static final boolean IS_ANDROID
-
-
Method Detail
-
newNameResolver
public NameResolver newNameResolver(java.net.URI targetUri, NameResolver.Args args)
Description copied from class:NameResolver.FactoryCreates aNameResolverfor the given target URI, ornullif the given URI cannot be resolved by this factory. The decision should be solely based on the scheme of the URI.- Specified by:
newNameResolverin classNameResolver.Factory- Parameters:
targetUri- the target URI to be resolved, whose scheme must not benullargs- other information that may be useful
-
getDefaultScheme
public java.lang.String getDefaultScheme()
Description copied from class:NameResolver.FactoryReturns the default scheme, which will be used to construct a URI whenManagedChannelBuilder.forTarget(String)is given an authority string instead of a compliant URI.- Specified by:
getDefaultSchemein classNameResolver.Factory
-
isAvailable
protected boolean isAvailable()
Description copied from class:NameResolverProviderWhether this provider is available for use, taking the current environment into consideration. Iffalse, no other methods are safe to be called.- Specified by:
isAvailablein classNameResolverProvider
-
priority
public int priority()
Description copied from class:NameResolverProviderA priority, from 0 to 10 that this provider should be used, taking the current environment into consideration. 5 should be considered the default, and then tweaked based on environment detection. A priority of 0 does not imply that the provider wouldn't work; just that it should be last in line.- Specified by:
priorityin classNameResolverProvider
-
getProducedSocketAddressTypes
public java.util.Collection<java.lang.Class<? extends java.net.SocketAddress>> getProducedSocketAddressTypes()
Description copied from class:NameResolverProviderReturns theSocketAddresstypes this provider's name-resolver is capable of producing. This enables selection of the appropriateManagedChannelProviderfor a channel.- Overrides:
getProducedSocketAddressTypesin classNameResolverProvider- Returns:
- the
SocketAddresstypes this provider's name-resolver is capable of producing.
-
-