Package io.grpc
Class ManagedChannelRegistry
- java.lang.Object
-
- io.grpc.ManagedChannelRegistry
-
@Internal @ThreadSafe public final class ManagedChannelRegistry extends Object
Registry ofManagedChannelProvider
s. Thedefault instance
loads providers at runtime through the Java service provider mechanism.- Since:
- 1.32.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ManagedChannelRegistry.ProviderNotFoundException
Thrown when no suitableManagedChannelProvider
objects can be found.
-
Constructor Summary
Constructors Constructor Description ManagedChannelRegistry()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
deregister(ManagedChannelProvider provider)
Deregisters a provider.static ManagedChannelRegistry
getDefaultRegistry()
Returns the default registry that loads providers via the Java service loader mechanism.void
register(ManagedChannelProvider provider)
Register a provider.
-
-
-
Method Detail
-
register
public void register(ManagedChannelProvider 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(ManagedChannelProvider 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.ManagedChannelProvider)
.
-
getDefaultRegistry
public static ManagedChannelRegistry getDefaultRegistry()
Returns the default registry that loads providers via the Java service loader mechanism.
-
-