@ExperimentalApi public abstract class NameResolverProvider extends NameResolver.Factory
Implementations should not throw. If they do, it may interrupt class loading. If
exceptions may reasonably occur for implementation-specific reasons, implementations should
generally handle the exception gracefully and return false from isAvailable().
| Modifier and Type | Field and Description |
|---|---|
static Attributes.Key<Integer> |
PARAMS_DEFAULT_PORT
The port number used in case the target or the underlying naming system doesn't provide a
port number.
|
| Constructor and Description |
|---|
NameResolverProvider() |
| Modifier and Type | Method and Description |
|---|---|
static NameResolver.Factory |
asFactory() |
static Iterable<NameResolverProvider> |
getCandidatesViaHardCoded()
Load providers from a hard-coded list.
|
static Iterable<NameResolverProvider> |
getCandidatesViaServiceLoader(ClassLoader classLoader)
Loads service providers for the
NameResolverProvider service using
ServiceLoader. |
protected abstract boolean |
isAvailable()
Whether this provider is available for use, taking the current environment into consideration.
|
protected abstract int |
priority()
A priority, from 0 to 10 that this provider should be used, taking the current environment into
consideration.
|
static List<NameResolverProvider> |
providers()
Returns non-
null ClassLoader-wide providers, in preference order. |
getDefaultScheme, newNameResolverpublic static final Attributes.Key<Integer> PARAMS_DEFAULT_PORT
public static Iterable<NameResolverProvider> getCandidatesViaServiceLoader(ClassLoader classLoader)
NameResolverProvider service using
ServiceLoader.public static Iterable<NameResolverProvider> getCandidatesViaHardCoded()
public static List<NameResolverProvider> providers()
null ClassLoader-wide providers, in preference order.public static NameResolver.Factory asFactory()
protected abstract boolean isAvailable()
false, no other methods are safe to be called.protected abstract int priority()