Package io.grpc.util

Class MutableHandlerRegistry


  • @ThreadSafe
    public final class MutableHandlerRegistry
    extends io.grpc.HandlerRegistry
    Default implementation of HandlerRegistry.

    Uses ConcurrentHashMap to avoid service registration excessively blocking method lookup.

    • Constructor Detail

      • MutableHandlerRegistry

        public MutableHandlerRegistry()
    • Method Detail

      • addService

        @Nullable
        public io.grpc.ServerServiceDefinition addService​(io.grpc.ServerServiceDefinition service)
        Registers a service.
        Returns:
        the previously registered service with the same service descriptor name if exists, otherwise null.
      • addService

        @Nullable
        public io.grpc.ServerServiceDefinition addService​(io.grpc.BindableService bindableService)
        Registers a service.
        Returns:
        the previously registered service with the same service descriptor name if exists, otherwise null.
      • removeService

        public boolean removeService​(io.grpc.ServerServiceDefinition service)
        Removes a registered service.
        Returns:
        true if the service was found to be removed.
      • getServices

        @ExperimentalApi("https://github.com/grpc/grpc-java/issues/2222")
        public List<io.grpc.ServerServiceDefinition> getServices()
        Note: This does not necessarily return a consistent view of the map.
        Overrides:
        getServices in class io.grpc.HandlerRegistry
      • lookupMethod

        @Nullable
        public io.grpc.ServerMethodDefinition<?,​?> lookupMethod​(String methodName,
                                                                      @Nullable
                                                                      String authority)
        Note: This does not actually honor the authority provided. It will, eventually in the future.
        Specified by:
        lookupMethod in class io.grpc.HandlerRegistry