mirror of https://github.com/grpc/grpc-java.git
Add a missing channel builder methods not copied in b687bdc
This commit is contained in:
parent
b687bdc742
commit
6122dafee0
|
|
@ -55,10 +55,25 @@ public abstract class ManagedChannelBuilder<T extends ManagedChannelBuilder<T>>
|
||||||
/**
|
/**
|
||||||
* Adds interceptors that will be called before the channel performs its real work. This is
|
* 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
|
* 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<ClientInterceptor> interceptors);
|
public abstract T intercept(List<ClientInterceptor> 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.
|
||||||
|
*
|
||||||
|
* <p>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.
|
* Builds a channel using the given parameters.
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -57,35 +57,19 @@ public abstract class AbstractManagedChannelImplBuilder
|
||||||
@Nullable
|
@Nullable
|
||||||
private String userAgent;
|
private String userAgent;
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* Provides a custom executor.
|
|
||||||
*
|
|
||||||
* <p>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.
|
|
||||||
*
|
|
||||||
* <p>The channel won't take ownership of the given executor. It's caller's responsibility to
|
|
||||||
* shut down the executor when it's desired.
|
|
||||||
*/
|
|
||||||
public final T executor(ExecutorService executor) {
|
public final T executor(ExecutorService executor) {
|
||||||
this.executor = executor;
|
this.executor = executor;
|
||||||
return thisT();
|
return thisT();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* 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}.
|
|
||||||
*/
|
|
||||||
public final T intercept(List<ClientInterceptor> interceptors) {
|
public final T intercept(List<ClientInterceptor> interceptors) {
|
||||||
this.interceptors.addAll(interceptors);
|
this.interceptors.addAll(interceptors);
|
||||||
return thisT();
|
return thisT();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* 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}.
|
|
||||||
*/
|
|
||||||
public final T intercept(ClientInterceptor... interceptors) {
|
public final T intercept(ClientInterceptor... interceptors) {
|
||||||
return intercept(Arrays.asList(interceptors));
|
return intercept(Arrays.asList(interceptors));
|
||||||
}
|
}
|
||||||
|
|
@ -96,20 +80,13 @@ public abstract class AbstractManagedChannelImplBuilder
|
||||||
return thisT;
|
return thisT;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* Provides a custom {@code User-Agent} for the application.
|
|
||||||
*
|
|
||||||
* <p>It's an optional parameter. If provided, the given agent will be prepended by the
|
|
||||||
* grpc {@code User-Agent}.
|
|
||||||
*/
|
|
||||||
public final T userAgent(String userAgent) {
|
public final T userAgent(String userAgent) {
|
||||||
this.userAgent = userAgent;
|
this.userAgent = userAgent;
|
||||||
return thisT();
|
return thisT();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* Builds a channel using the given parameters.
|
|
||||||
*/
|
|
||||||
public ManagedChannelImpl build() {
|
public ManagedChannelImpl build() {
|
||||||
ClientTransportFactory transportFactory = buildTransportFactory();
|
ClientTransportFactory transportFactory = buildTransportFactory();
|
||||||
return new ManagedChannelImpl(transportFactory, executor, userAgent, interceptors);
|
return new ManagedChannelImpl(transportFactory, executor, userAgent, interceptors);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue