Package io.grpc
Class NameResolverRegistry
- java.lang.Object
-
- io.grpc.NameResolverRegistry
-
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/4159") @ThreadSafe public final class NameResolverRegistry extends Object
Registry ofNameResolverProvider
s. Thedefault instance
loads providers at runtime through the Java service provider mechanism.- Since:
- 1.21.0
-
-
Constructor Summary
Constructors Constructor Description NameResolverRegistry()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description NameResolver.Factory
asFactory()
void
deregister(NameResolverProvider provider)
Deregisters a provider.static NameResolverRegistry
getDefaultRegistry()
Returns the default registry that loads providers via the Java service loader mechanism.String
getDefaultScheme()
NameResolverProvider
getProviderForScheme(String scheme)
void
register(NameResolverProvider provider)
Register a provider.
-
-
-
Method Detail
-
getDefaultScheme
public String getDefaultScheme()
-
getProviderForScheme
public NameResolverProvider getProviderForScheme(String scheme)
-
register
public void register(NameResolverProvider provider)
Register a provider.If the provider's
isAvailable()
returnsfalse
, this method will throwIllegalArgumentException
.Providers will be used in priority order. In case of ties, providers are used in registration order.
-
deregister
public void deregister(NameResolverProvider provider)
Deregisters a provider. No-op if the provider is not in the registry.- Parameters:
provider
- the provider that was added to the register viaregister(io.grpc.NameResolverProvider)
.
-
getDefaultRegistry
public static NameResolverRegistry getDefaultRegistry()
Returns the default registry that loads providers via the Java service loader mechanism.
-
asFactory
public NameResolver.Factory asFactory()
-
-