BuilderT
- The concrete type of this builder.public abstract class AbstractChannelBuilder<BuilderT extends AbstractChannelBuilder<BuilderT>> extends Object
Modifier and Type | Class and Description |
---|---|
protected static class |
AbstractChannelBuilder.ChannelEssentials
The essentials required for creating a channel.
|
Constructor and Description |
---|
AbstractChannelBuilder() |
Modifier and Type | Method and Description |
---|---|
ChannelImpl |
build()
Builds a channel using the given parameters.
|
protected abstract AbstractChannelBuilder.ChannelEssentials |
buildEssentials()
Children of AbstractChannelBuilder should override this method to provide transport specific
information for the channel.
|
BuilderT |
executor(ExecutorService executor)
Provides a custom executor.
|
BuilderT |
intercept(ClientInterceptor... interceptors)
Adds interceptors that will be called before the channel performs its real work.
|
BuilderT |
intercept(List<ClientInterceptor> interceptors)
Adds interceptors that will be called before the channel performs its real work.
|
BuilderT |
userAgent(String userAgent)
Provides a custom
User-Agent for the application. |
public final BuilderT executor(ExecutorService 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.
public final BuilderT intercept(List<ClientInterceptor> interceptors)
ClientInterceptors.intercept(Channel, List)
, but while
still having access to the original ChannelImpl
.public final BuilderT intercept(ClientInterceptor... interceptors)
ClientInterceptors.intercept(Channel,
ClientInterceptor...)
, but while still having access to the original ChannelImpl
.public final BuilderT userAgent(String userAgent)
User-Agent
for the application.
It's an optional parameter. If provided, the given agent will be prepended by the
grpc User-Agent
.
public ChannelImpl build()
@Internal protected abstract AbstractChannelBuilder.ChannelEssentials buildEssentials()