Package io.grpc

Class ServerRegistry

java.lang.Object
io.grpc.ServerRegistry

@Internal @ThreadSafe public final class ServerRegistry extends Object
Registry of ServerProviders. The default instance loads providers at runtime through the Java service provider mechanism.
  • Constructor Details

    • ServerRegistry

      public ServerRegistry()
  • Method Details

    • register

      public void register(ServerProvider provider)
      Register a provider.

      If the provider's isAvailable() returns false, this method will throw IllegalArgumentException.

      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 via register(io.grpc.ServerProvider).
    • getDefaultRegistry

      public static ServerRegistry getDefaultRegistry()
      Returns the default registry that loads providers via the Java service loader mechanism.