@ExperimentalApi(value="https://github.com/grpc/grpc-java/issues/1785") public final class OkHttpServerBuilder extends ForwardingServerBuilder<OkHttpServerBuilder>
| Modifier and Type | Method and Description |
|---|---|
protected ServerBuilder<?> |
delegate()
Returns the delegated
ServerBuilder. |
OkHttpServerBuilder |
flowControlWindow(int flowControlWindow)
Sets the flow control window in bytes.
|
static OkHttpServerBuilder |
forPort(int port)
Deprecated.
Use
forPort(int, ServerCredentials) instead |
static OkHttpServerBuilder |
forPort(int port,
ServerCredentials creds)
Creates a builder for a server listening on
port. |
static OkHttpServerBuilder |
forPort(SocketAddress address,
ServerCredentials creds)
Creates a builder for a server listening on
address. |
OkHttpServerBuilder |
keepAliveTime(long keepAliveTime,
TimeUnit timeUnit)
Sets the time without read activity before sending a keepalive ping.
|
OkHttpServerBuilder |
keepAliveTimeout(long keepAliveTimeout,
TimeUnit timeUnit)
Sets a time waiting for read activity after sending a keepalive ping.
|
OkHttpServerBuilder |
maxConnectionIdle(long maxConnectionIdle,
TimeUnit timeUnit)
Sets a custom max connection idle time, connection being idle for longer than which will be
gracefully terminated.
|
OkHttpServerBuilder |
maxInboundMessageSize(int bytes)
Sets the maximum message size allowed to be received on the server.
|
OkHttpServerBuilder |
maxInboundMetadataSize(int bytes)
Sets the maximum size of metadata allowed to be received.
|
OkHttpServerBuilder |
permitKeepAliveTime(long keepAliveTime,
TimeUnit timeUnit)
Specify the most aggressive keep-alive time clients are permitted to configure.
|
OkHttpServerBuilder |
permitKeepAliveWithoutCalls(boolean permit)
Sets whether to allow clients to send keep-alive HTTP/2 PINGs even if there are no outstanding
RPCs on the connection.
|
OkHttpServerBuilder |
scheduledExecutorService(ScheduledExecutorService scheduledExecutorService)
Provides a custom scheduled executor service.
|
OkHttpServerBuilder |
socketFactory(ServerSocketFactory socketFactory)
Override the default
ServerSocketFactory used to listen. |
OkHttpServerBuilder |
transportExecutor(Executor transportExecutor)
Override the default executor necessary for internal transport use.
|
addService, addService, addStreamTracerFactory, addTransportFilter, build, callExecutor, compressorRegistry, decompressorRegistry, directExecutor, executor, fallbackHandlerRegistry, handshakeTimeout, intercept, maxConnectionAge, maxConnectionAgeGrace, setBinaryLog, toString, useTransportSecurity, useTransportSecurityaddServices@Deprecated public static OkHttpServerBuilder forPort(int port)
forPort(int, ServerCredentials) insteadServerBuilder.forPort().public static OkHttpServerBuilder forPort(int port, ServerCredentials creds)
port.public static OkHttpServerBuilder forPort(SocketAddress address, ServerCredentials creds)
address.@Internal protected ServerBuilder<?> delegate()
ForwardingServerBuilderServerBuilder.delegate in class ForwardingServerBuilder<OkHttpServerBuilder>public OkHttpServerBuilder transportExecutor(Executor transportExecutor)
The channel does not take ownership of the given executor. It is the caller' responsibility to shutdown the executor when appropriate.
public OkHttpServerBuilder socketFactory(ServerSocketFactory socketFactory)
ServerSocketFactory used to listen. If the socket factory is not
set or set to null, a default one will be used.public OkHttpServerBuilder keepAliveTime(long keepAliveTime, TimeUnit timeUnit)
Long.MAX_VALUE nano seconds or an unreasonably large
value will disable keepalive. Defaults to two hours.keepAliveTime in class ForwardingServerBuilder<OkHttpServerBuilder>IllegalArgumentException - if time is not positivepublic OkHttpServerBuilder maxConnectionIdle(long maxConnectionIdle, TimeUnit timeUnit)
Long.MAX_VALUE nano seconds or an unreasonably large value will disable
max connection idle.maxConnectionIdle in class ForwardingServerBuilder<OkHttpServerBuilder>public OkHttpServerBuilder keepAliveTimeout(long keepAliveTimeout, TimeUnit timeUnit)
This value should be at least multiple times the RTT to allow for lost packets.
keepAliveTimeout in class ForwardingServerBuilder<OkHttpServerBuilder>IllegalArgumentException - if timeout is not positive@CanIgnoreReturnValue public OkHttpServerBuilder permitKeepAliveTime(long keepAliveTime, TimeUnit timeUnit)
Even though a default is defined that allows some keep-alives, clients must not use keep-alive without approval from the service owner. Otherwise, they may experience failures in the future if the service becomes more restrictive. When unthrottled, keep-alives can cause a significant amount of traffic and CPU usage, so clients and servers should be conservative in what they use and accept.
permitKeepAliveTime in class ForwardingServerBuilder<OkHttpServerBuilder>permitKeepAliveWithoutCalls(boolean)@CanIgnoreReturnValue public OkHttpServerBuilder permitKeepAliveWithoutCalls(boolean permit)
false.permitKeepAliveWithoutCalls in class ForwardingServerBuilder<OkHttpServerBuilder>permitKeepAliveTime(long, TimeUnit)public OkHttpServerBuilder flowControlWindow(int flowControlWindow)
public OkHttpServerBuilder scheduledExecutorService(ScheduledExecutorService scheduledExecutorService)
It's an optional parameter. If the user has not provided a scheduled executor service when the channel is built, the builder will use a static thread pool.
public OkHttpServerBuilder maxInboundMetadataSize(int bytes)
The implementation does not currently limit memory usage; this value is checked only after the metadata is decoded from the wire. It does prevent large metadata from being passed to the application.
maxInboundMetadataSize in class ForwardingServerBuilder<OkHttpServerBuilder>bytes - the maximum size of received metadataIllegalArgumentException - if bytes is non-positivepublic OkHttpServerBuilder maxInboundMessageSize(int bytes)
maxInboundMessageSize in class ForwardingServerBuilder<OkHttpServerBuilder>bytes - the maximum number of bytes a single message can be.IllegalArgumentException - if bytes is negative.