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