@ExperimentalApi public final class DnsNameResolverFactory extends NameResolver.Factory
DnsNameResolver
.
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)PARAMS_DEFAULT_PORT
Modifier and Type | Method and Description |
---|---|
String |
getDefaultScheme()
Returns the default scheme, which will be used to construct a URI when
ManagedChannelBuilder.forTarget(String) is given an authority string instead of a compliant
URI. |
static DnsNameResolverFactory |
getInstance() |
NameResolver |
newNameResolver(URI targetUri,
Attributes params)
Creates a
NameResolver for the given target URI, or null if the given URI
cannot be resolved by this factory. |
public NameResolver newNameResolver(URI targetUri, Attributes params)
NameResolver.Factory
NameResolver
for the given target URI, or null
if the given URI
cannot be resolved by this factory. The decision should be solely based on the scheme of the
URI.newNameResolver
in class NameResolver.Factory
targetUri
- the target URI to be resolved, whose scheme must not be null
params
- optional parameters. Canonical keys are defined as PARAMS_*
fields in
NameResolver.Factory
.public String getDefaultScheme()
NameResolver.Factory
ManagedChannelBuilder.forTarget(String)
is given an authority string instead of a compliant
URI.getDefaultScheme
in class NameResolver.Factory
public static DnsNameResolverFactory getInstance()