diff --git a/core/src/main/java/io/grpc/ManagedChannelBuilder.java b/core/src/main/java/io/grpc/ManagedChannelBuilder.java index 7b1696e4dc..0745cddd8f 100644 --- a/core/src/main/java/io/grpc/ManagedChannelBuilder.java +++ b/core/src/main/java/io/grpc/ManagedChannelBuilder.java @@ -159,10 +159,14 @@ public abstract class ManagedChannelBuilder> public abstract T usePlaintext(boolean skipNegotiation); /** - * Provides a custom {@link NameResolver.Factory} for the channel. + * Provides a custom {@link NameResolver.Factory} for the channel. If this method is not called, + * the builder will try the providers listed by {@link NameResolverProvider#providers()} for the + * given target. * - *

If this method is not called, the builder will try the providers listed by {@link - * NameResolverProvider#providers()} for the given target. + *

This method should rarely be used, as name resolvers should provide a {@code + * NameResolverProvider} and users rely on service loading to find implementations in the class + * path. That allows application's configuration to easily choose the name resolver via the + * 'target' string passed to {@link ManagedChannelBuilder#forTarget(String)}. * * @return this * @since 1.0.0 diff --git a/core/src/main/java/io/grpc/NameResolverProvider.java b/core/src/main/java/io/grpc/NameResolverProvider.java index d056ac4605..34c36c5e27 100644 --- a/core/src/main/java/io/grpc/NameResolverProvider.java +++ b/core/src/main/java/io/grpc/NameResolverProvider.java @@ -33,7 +33,7 @@ import java.util.ServiceLoader; * exceptions may reasonably occur for implementation-specific reasons, implementations should * generally handle the exception gracefully and return {@code false} from {@link #isAvailable()}. */ -@Internal +@ExperimentalApi public abstract class NameResolverProvider extends NameResolver.Factory { /** * The port number used in case the target or the underlying naming system doesn't provide a