diff --git a/core/src/main/java/io/grpc/ManagedChannelBuilder.java b/core/src/main/java/io/grpc/ManagedChannelBuilder.java index 18f38099c8..3fd56c1fe5 100644 --- a/core/src/main/java/io/grpc/ManagedChannelBuilder.java +++ b/core/src/main/java/io/grpc/ManagedChannelBuilder.java @@ -55,10 +55,25 @@ public abstract class ManagedChannelBuilder> /** * Adds interceptors that will be called before the channel performs its real work. This is * functionally equivalent to using {@link ClientInterceptors#intercept(Channel, List)}, but while - * still having access to the original {@code ChannelImpl}. + * still having access to the original {@code ManagedChannel}. */ public abstract T intercept(List interceptors); + /** + * Adds interceptors that will be called before the channel performs its real work. This is + * functionally equivalent to using {@link ClientInterceptors#intercept(Channel, + * ClientInterceptor...)}, but while still having access to the original {@code ManagedChannel}. + */ + public abstract T intercept(ClientInterceptor... interceptors); + + /** + * Provides a custom {@code User-Agent} for the application. + * + *

It's an optional parameter. If provided, the given agent will be prepended by the + * grpc {@code User-Agent}. + */ + public abstract T userAgent(String userAgent); + /** * Builds a channel using the given parameters. */ diff --git a/core/src/main/java/io/grpc/internal/AbstractManagedChannelImplBuilder.java b/core/src/main/java/io/grpc/internal/AbstractManagedChannelImplBuilder.java index e9992b254d..dd81e130df 100644 --- a/core/src/main/java/io/grpc/internal/AbstractManagedChannelImplBuilder.java +++ b/core/src/main/java/io/grpc/internal/AbstractManagedChannelImplBuilder.java @@ -57,35 +57,19 @@ public abstract class AbstractManagedChannelImplBuilder @Nullable private String userAgent; - /** - * Provides a custom executor. - * - *

It's an optional parameter. If the user has not provided an executor when the channel is - * built, the builder will use a static cached thread pool. - * - *

The channel won't take ownership of the given executor. It's caller's responsibility to - * shut down the executor when it's desired. - */ + @Override public final T executor(ExecutorService executor) { this.executor = executor; return thisT(); } - /** - * Adds interceptors that will be called before the channel performs its real work. This is - * functionally equivalent to using {@link io.grpc.ClientInterceptors#intercept(io.grpc.Channel, - * List)}, but while still having access to the original {@code ChannelImpl}. - */ + @Override public final T intercept(List interceptors) { this.interceptors.addAll(interceptors); return thisT(); } - /** - * Adds interceptors that will be called before the channel performs its real work. This is - * functionally equivalent to using {@link io.grpc.ClientInterceptors#intercept(io.grpc.Channel, - * ClientInterceptor...)}, but while still having access to the original {@code ChannelImpl}. - */ + @Override public final T intercept(ClientInterceptor... interceptors) { return intercept(Arrays.asList(interceptors)); } @@ -96,20 +80,13 @@ public abstract class AbstractManagedChannelImplBuilder return thisT; } - /** - * Provides a custom {@code User-Agent} for the application. - * - *

It's an optional parameter. If provided, the given agent will be prepended by the - * grpc {@code User-Agent}. - */ + @Override public final T userAgent(String userAgent) { this.userAgent = userAgent; return thisT(); } - /** - * Builds a channel using the given parameters. - */ + @Override public ManagedChannelImpl build() { ClientTransportFactory transportFactory = buildTransportFactory(); return new ManagedChannelImpl(transportFactory, executor, userAgent, interceptors);