@ExperimentalApi(value="https://github.com/grpc/grpc-java/issues/1784") @CanIgnoreReturnValue public final class NettyChannelBuilder extends io.grpc.internal.AbstractManagedChannelImplBuilder<NettyChannelBuilder>
| Modifier and Type | Class and Description | 
|---|---|
| static class  | NettyChannelBuilder.LocalSocketPickerThis class is meant to be overriden with a custom implementation of
  NettyChannelBuilder.LocalSocketPicker.createSocketAddress(java.net.SocketAddress, io.grpc.Attributes). | 
| Modifier and Type | Field and Description | 
|---|---|
| static int | DEFAULT_FLOW_CONTROL_WINDOW | 
| Modifier and Type | Method and Description | 
|---|---|
| NettyChannelBuilder | channelFactory(io.netty.channel.ChannelFactory<? extends io.netty.channel.Channel> channelFactory)Specifies the  ChannelFactoryto createChannelinstances. | 
| NettyChannelBuilder | channelType(Class<? extends io.netty.channel.Channel> channelType)Specifies the channel type to use, by default we use  EpollSocketChannelif available,
 otherwise usingNioSocketChannel. | 
| protected io.grpc.ManagedChannelBuilder<?> | delegate() | 
| NettyChannelBuilder | eventLoopGroup(io.netty.channel.EventLoopGroup eventLoopGroup)Provides an EventGroupLoop to be used by the netty transport. | 
| NettyChannelBuilder | flowControlWindow(int flowControlWindow)Sets the flow control window in bytes. | 
| static NettyChannelBuilder | forAddress(SocketAddress serverAddress)Creates a new builder with the given server address. | 
| static NettyChannelBuilder | forAddress(SocketAddress serverAddress,
          io.grpc.ChannelCredentials creds)Creates a new builder with the given server address. | 
| static NettyChannelBuilder | forAddress(String host,
          int port)Creates a new builder with the given host and port. | 
| static NettyChannelBuilder | forAddress(String host,
          int port,
          io.grpc.ChannelCredentials creds)Creates a new builder with the given host and port. | 
| static NettyChannelBuilder | forTarget(String target)Creates a new builder with the given target string that will be resolved by
  NameResolver. | 
| static NettyChannelBuilder | forTarget(String target,
         io.grpc.ChannelCredentials creds)Creates a new builder with the given target string that will be resolved by
  NameResolver. | 
| NettyChannelBuilder | initialFlowControlWindow(int initialFlowControlWindow)Sets the initial flow control window in bytes. | 
| NettyChannelBuilder | keepAliveTime(long keepAliveTime,
             TimeUnit timeUnit) | 
| NettyChannelBuilder | keepAliveTimeout(long keepAliveTimeout,
                TimeUnit timeUnit) | 
| NettyChannelBuilder | keepAliveWithoutCalls(boolean enable) | 
| NettyChannelBuilder | localSocketPicker(NettyChannelBuilder.LocalSocketPicker localSocketPicker)If non- null, attempts to create connections bound to a local port. | 
| NettyChannelBuilder | maxHeaderListSize(int maxHeaderListSize)Deprecated. 
 Use  maxInboundMetadataSize(int)instead | 
| NettyChannelBuilder | maxInboundMessageSize(int max)Sets the maximum message size allowed for a single gRPC frame. | 
| NettyChannelBuilder | maxInboundMetadataSize(int bytes)Sets the maximum size of metadata allowed to be received. | 
| NettyChannelBuilder | negotiationType(NegotiationType type)Sets the negotiation type for the HTTP/2 connection. | 
| NettyChannelBuilder | sslContext(io.netty.handler.ssl.SslContext sslContext)SSL/TLS context to use instead of the system default. | 
| NettyChannelBuilder | usePlaintext()Equivalent to using  negotiationType(NegotiationType)withPLAINTEXT. | 
| NettyChannelBuilder | useTransportSecurity()Equivalent to using  negotiationType(NegotiationType)withTLS. | 
| <T> NettyChannelBuilder | withOption(io.netty.channel.ChannelOption<T> option,
          T value)Specifies a channel option. | 
build, compressorRegistry, decompressorRegistry, defaultLoadBalancingPolicy, defaultServiceConfig, directExecutor, disableRetry, disableServiceConfigLookUp, enableFullStreamDecompression, enableRetry, executor, idleTimeout, intercept, intercept, maxHedgedAttempts, maxRetryAttempts, maxTraceEvents, nameResolverFactory, offloadExecutor, overrideAuthority, perRpcBufferLimit, proxyDetector, retryBufferSize, setBinaryLog, thisT, toString, userAgentpublic static final int DEFAULT_FLOW_CONTROL_WINDOW
@CheckReturnValue public static NettyChannelBuilder forAddress(SocketAddress serverAddress)
forAddress(String, int) should
 generally be preferred over this method, since that API permits delaying DNS lookups and
 noticing changes to DNS. If an unresolved InetSocketAddress is passed in, then it will remain
 unresolved.@CheckReturnValue public static NettyChannelBuilder forAddress(SocketAddress serverAddress, io.grpc.ChannelCredentials creds)
forAddress(String, int, ChannelCredentials) should generally be preferred over this
 method, since that API permits delaying DNS lookups and noticing changes to DNS. If an
 unresolved InetSocketAddress is passed in, then it will remain unresolved.@CheckReturnValue public static NettyChannelBuilder forAddress(String host, int port)
@CheckReturnValue public static NettyChannelBuilder forAddress(String host, int port, io.grpc.ChannelCredentials creds)
@CheckReturnValue public static NettyChannelBuilder forTarget(String target)
NameResolver.@CheckReturnValue public static NettyChannelBuilder forTarget(String target, io.grpc.ChannelCredentials creds)
NameResolver.@Internal protected io.grpc.ManagedChannelBuilder<?> delegate()
delegate in class io.grpc.internal.AbstractManagedChannelImplBuilder<NettyChannelBuilder>public NettyChannelBuilder channelType(Class<? extends io.netty.channel.Channel> channelType)
EpollSocketChannel if available,
 otherwise using NioSocketChannel.
 You either use this or channelFactory(io.netty.channel.ChannelFactory) if your
 Channel implementation has no no-args constructor.
 
It's an optional parameter. If the user has not provided an Channel type or ChannelFactory when the channel is built, the builder will use the default one which is static.
You must also provide corresponding eventLoopGroup(EventLoopGroup). For example,
 NioSocketChannel must use NioEventLoopGroup, otherwise
 your application won't start.
public NettyChannelBuilder channelFactory(io.netty.channel.ChannelFactory<? extends io.netty.channel.Channel> channelFactory)
ChannelFactory to create Channel instances. This method is
 usually only used if the specific Channel requires complex logic which requires
 additional information to create the Channel. Otherwise, recommend to use channelType(Class).
 It's an optional parameter. If the user has not provided an Channel type or ChannelFactory when the channel is built, the builder will use the default one which is static.
You must also provide corresponding eventLoopGroup(EventLoopGroup). For example,
 NioSocketChannel based ChannelFactory must use NioEventLoopGroup, otherwise your application won't start.
public <T> NettyChannelBuilder withOption(io.netty.channel.ChannelOption<T> option, T value)
public NettyChannelBuilder negotiationType(NegotiationType type)
Default: TLS
public NettyChannelBuilder eventLoopGroup(@Nullable io.netty.channel.EventLoopGroup eventLoopGroup)
It's an optional parameter. If the user has not provided an EventGroupLoop when the channel is built, the builder will use the default one which is static.
You must also provide corresponding channelType(Class) or channelFactory(ChannelFactory) corresponding to the given EventLoopGroup. For
 example, NioEventLoopGroup requires NioSocketChannel
 
The channel won't take ownership of the given EventLoopGroup. It's caller's responsibility to shut it down when it's desired.
public NettyChannelBuilder sslContext(io.netty.handler.ssl.SslContext sslContext)
GrpcSslContexts, but options could have been overridden.public NettyChannelBuilder initialFlowControlWindow(int initialFlowControlWindow)
flowControlWindow(int). By default, auto flow control is enabled with
 initial flow control window size of DEFAULT_FLOW_CONTROL_WINDOW.public NettyChannelBuilder flowControlWindow(int flowControlWindow)
initialFlowControlWindow(int) to enable auto flow control tuning. If not
 called, the default value is DEFAULT_FLOW_CONTROL_WINDOW) with auto flow control
 tuning.@Deprecated @InlineMe(replacement="this.maxInboundMetadataSize(maxHeaderListSize)") public NettyChannelBuilder maxHeaderListSize(int maxHeaderListSize)
maxInboundMetadataSize(int) insteadpublic NettyChannelBuilder maxInboundMetadataSize(int bytes)
maxInboundMetadataSize in class io.grpc.internal.AbstractManagedChannelImplBuilder<NettyChannelBuilder>bytes - the maximum size of received metadataIllegalArgumentException - if bytes is non-positivepublic NettyChannelBuilder usePlaintext()
negotiationType(NegotiationType) with PLAINTEXT.usePlaintext in class io.grpc.internal.AbstractManagedChannelImplBuilder<NettyChannelBuilder>public NettyChannelBuilder useTransportSecurity()
negotiationType(NegotiationType) with TLS.useTransportSecurity in class io.grpc.internal.AbstractManagedChannelImplBuilder<NettyChannelBuilder>public NettyChannelBuilder keepAliveTime(long keepAliveTime, TimeUnit timeUnit)
keepAliveTime in class io.grpc.internal.AbstractManagedChannelImplBuilder<NettyChannelBuilder>public NettyChannelBuilder keepAliveTimeout(long keepAliveTimeout, TimeUnit timeUnit)
keepAliveTimeout in class io.grpc.internal.AbstractManagedChannelImplBuilder<NettyChannelBuilder>public NettyChannelBuilder keepAliveWithoutCalls(boolean enable)
keepAliveWithoutCalls in class io.grpc.internal.AbstractManagedChannelImplBuilder<NettyChannelBuilder>public NettyChannelBuilder localSocketPicker(@Nullable NettyChannelBuilder.LocalSocketPicker localSocketPicker)
null, attempts to create connections bound to a local port.public NettyChannelBuilder maxInboundMessageSize(int max)
maxInboundMessageSize in class io.grpc.internal.AbstractManagedChannelImplBuilder<NettyChannelBuilder>