Package io.grpc

Class NameResolverProvider


  • @ExperimentalApi("https://github.com/grpc/grpc-java/issues/4159")
    public abstract class NameResolverProvider
    extends NameResolver.Factory
    Provider of name resolvers for name agnostic consumption.

    Implementations should not throw. If they do, it may interrupt class loading. If exceptions may reasonably occur for implementation-specific reasons, implementations should generally handle the exception gracefully and return false from isAvailable().

    • Field Detail

      • PARAMS_DEFAULT_PORT

        @Deprecated
        public static final Attributes.Key<java.lang.Integer> PARAMS_DEFAULT_PORT
        Deprecated.
        The port number used in case the target or the underlying naming system doesn't provide a port number.
        Since:
        1.0.0
    • Constructor Detail

      • NameResolverProvider

        public NameResolverProvider()
    • Method Detail

      • providers

        @Deprecated
        public static java.util.List<NameResolverProvider> providers()
        Deprecated.
        Has no replacement
        Returns non-null ClassLoader-wide providers, in preference order.
        Since:
        1.0.0
      • asFactory

        @Deprecated
        public static NameResolver.Factory asFactory()
        Deprecated.
        Use NameResolverRegistry.getDefaultRegistry().asFactory()
        Since:
        1.0.0
      • isAvailable

        protected abstract boolean isAvailable()
        Whether this provider is available for use, taking the current environment into consideration. If false, no other methods are safe to be called.
        Since:
        1.0.0
      • priority

        protected abstract int priority()
        A priority, from 0 to 10 that this provider should be used, taking the current environment into consideration. 5 should be considered the default, and then tweaked based on environment detection. A priority of 0 does not imply that the provider wouldn't work; just that it should be last in line.
        Since:
        1.0.0