ServerBuilder that delegates all its builder methods to another builder by default.
| Access | Constructor and Description |
|---|---|
| protected |
| Modifier and Type | Method and Description |
|---|---|
| public T | addService(ServerServiceDefinition
ServerServiceDefinition object service)Implements abstract io. |
| public T | addService(BindableService
BindableService object bindableService)Implements abstract io. |
| public T | addStreamTracerFactory(ServerStreamTracer.
Overrides io. ServerStreamTracer. to measure server-side traffic.
|
| public T | addTransportFilter(ServerTransportFilter filter)
Overrides io. ServerTransportFilter.
|
| public Server | build()
Implements abstract io. Server built by the delegate by default.
|
| public T | callExecutor(ServerCallExecutorSupplier
the server call executor provider executorSupplier)Overrides io. |
| public T | compressorRegistry(CompressorRegistry registry)
Implements abstract io. |
| public T | decompressorRegistry(DecompressorRegistry registry)
Implements abstract io. |
| protected abstract ServerBuilder | |
| public T | directExecutor()
Implements abstract io. |
| public T | executor(Executor executor)
Implements abstract io. |
| public T | fallbackHandlerRegistry(HandlerRegistry fallbackRegistry)
Implements abstract io. |
| public static ServerBuilder | forPort(int
the port to listen on port)
This method serves to force sub classes to "hide" this static factory.
|
| public T | handshakeTimeout(long timeout, TimeUnit unit)
Overrides io. |
| public T | intercept(ServerInterceptor
the all-service interceptor interceptor)Overrides io. ServerInterceptor that is run for all services on the server.
|
| public T | keepAliveTime(long keepAliveTime, TimeUnit timeUnit)
Overrides io. |
| public T | keepAliveTimeout(long keepAliveTimeout, TimeUnit timeUnit)
Overrides io. |
| public T | maxConnectionAge(long maxConnectionAge, TimeUnit timeUnit)
Overrides io. |
| public T | maxConnectionAgeGrace(long maxConnectionAgeGrace, TimeUnit timeUnit)
Overrides io. |
| public T | maxConnectionIdle(long maxConnectionIdle, TimeUnit timeUnit)
Overrides io. |
| public T | maxInboundMessageSize(int
the maximum number of bytes a single message can be. bytes)Overrides io. |
| public T | maxInboundMetadataSize(int
the maximum size of received metadata bytes)Overrides io. |
| public T | permitKeepAliveTime(long keepAliveTime, TimeUnit timeUnit)
Overrides io. |
| public T | permitKeepAliveWithoutCalls(boolean permit)
Overrides io. |
| public T | setBinaryLog(BinaryLog
the object to provide logging. binaryLog)Overrides io. |
| private T | |
| public String | |
| public T | useTransportSecurity(File
file containing the full certificate chain certChain, File file containing the private key privateKey)Implements abstract io. |
| public T | useTransportSecurity(InputStream
InputStream containing the full certificate chain certChain, InputStream InputStream containing the private key privateKey)Overrides io. |
| ForwardingServerBuilder | back to summary |
|---|---|
| protected ForwardingServerBuilder() The default constructor. | |
| addService | back to summary |
|---|---|
| public T addService(ServerServiceDefinition service) Implements abstract io. Doc from io. Adds a service implementation to the handler registry.
| |
| addService | back to summary |
|---|---|
| public T addService(BindableService bindableService) Implements abstract io. Doc from io. Adds a service implementation to the handler registry.
| |
| addStreamTracerFactory | back to summary |
|---|---|
| public T addStreamTracerFactory(ServerStreamTracer. Overrides io. Doc from io. Adds a
| |
| addTransportFilter | back to summary |
|---|---|
| public T addTransportFilter(ServerTransportFilter filter) Overrides io. Doc from io. Adds a
| |
| build | back to summary |
|---|---|
| public Server build() Implements abstract io. Returns the
| |
| callExecutor | back to summary |
|---|---|
| public T callExecutor(ServerCallExecutorSupplier executorSupplier) Overrides io. Doc from io. Allows for defining a way to provide a custom executor to handle the server call.
This executor is the result of calling
It's an optional parameter. If it is provided, the
| |
| compressorRegistry | back to summary |
|---|---|
| public T compressorRegistry(CompressorRegistry registry) Implements abstract io. Doc from io. Set the compression registry for use in the channel. This is an advanced API call and
shouldn't be used unless you are using custom message encoding. The default supported
compressors are in
| |
| decompressorRegistry | back to summary |
|---|---|
| public T decompressorRegistry(DecompressorRegistry registry) Implements abstract io. Doc from io. Set the decompression registry for use in the channel. This is an advanced API call and
shouldn't be used unless you are using custom message encoding. The default supported
decompressors are in
| |
| delegate | back to summary |
|---|---|
| protected abstract ServerBuilder Returns the delegated | |
| directExecutor | back to summary |
|---|---|
| public T directExecutor() Implements abstract io. Doc from io. Execute application code directly in the transport thread. Depending on the underlying transport, using a direct executor may lead to substantial performance improvements. However, it also requires the application to not block under any circumstances. Calling this method is semantically equivalent to calling
| |
| executor | back to summary |
|---|---|
| public T executor(Executor executor) Implements abstract io. Doc from io. Provides a custom executor. It's an optional parameter. If the user has not provided an executor when the server is built, the builder will use a static cached thread pool. The server won't take ownership of the given executor. It's caller's responsibility to shut down the executor when it's desired.
| |
| fallbackHandlerRegistry | back to summary |
|---|---|
| public T fallbackHandlerRegistry(HandlerRegistry fallbackRegistry) Implements abstract io. Doc from io. Sets a fallback handler registry that will be looked up in if a method is not found in the
primary registry. The primary registry (configured via
| |
| forPort | back to summary |
|---|---|
| public static ServerBuilder Hides io. This method serves to force sub classes to "hide" this static factory.
| |
| handshakeTimeout | back to summary |
|---|---|
| public T handshakeTimeout(long timeout, TimeUnit unit) Overrides io. Doc from io. Sets the permitted time for new connections to complete negotiation handshakes before being killed. The default value is 2 minutes.
| |
| intercept | back to summary |
|---|---|
| public T intercept(ServerInterceptor interceptor) Overrides io. Doc from io. Adds a
| |
| keepAliveTime | back to summary |
|---|---|
| public T keepAliveTime(long keepAliveTime, TimeUnit timeUnit) Overrides io. Doc from io. Sets the time without read activity before sending a keepalive ping. An unreasonably small
value might be increased, and
| |
| keepAliveTimeout | back to summary |
|---|---|
| public T keepAliveTimeout(long keepAliveTimeout, TimeUnit timeUnit) Overrides io. Doc from io. Sets a time waiting for read activity after sending a keepalive ping. If the time expires without any read activity on the connection, the connection is considered dead. An unreasonably small value might be increased. Defaults to 20 seconds when supported. This value should be at least multiple times the RTT to allow for lost packets.
| |
| maxConnectionAge | back to summary |
|---|---|
| public T maxConnectionAge(long maxConnectionAge, TimeUnit timeUnit) Overrides io. Doc from io. Sets the maximum connection age, connections lasting longer than which will be gracefully
terminated. An unreasonably small value might be increased. A random jitter of +/-10% will be
added to it.
| |
| maxConnectionAgeGrace | back to summary |
|---|---|
| public T maxConnectionAgeGrace(long maxConnectionAgeGrace, TimeUnit timeUnit) Overrides io. Doc from io. Sets the grace time for the graceful connection termination. Once the max connection age
is reached, RPCs have the grace time to complete. RPCs that do not complete in time will be
cancelled, allowing the connection to terminate.
| |
| maxConnectionIdle | back to summary |
|---|---|
| public T maxConnectionIdle(long maxConnectionIdle, TimeUnit timeUnit) Overrides io. Doc from io. Sets the maximum connection idle time, connections being idle for longer than which will be
gracefully terminated. Idleness duration is defined since the most recent time the number of
outstanding RPCs became zero or the connection establishment. An unreasonably small value might
be increased.
| |
| maxInboundMessageSize | back to summary |
|---|---|
| public T maxInboundMessageSize(int bytes) Overrides io. Doc from io. Sets the maximum message size allowed to be received on the server. If not called, defaults to 4 MiB. The default provides protection to servers who haven't considered the possibility of receiving large messages while trying to be large enough to not be hit in normal usage. This method is advisory, and implementations may decide to not enforce this. Currently,
the only known transport to not enforce this is
| |
| maxInboundMetadataSize | back to summary |
|---|---|
| public T maxInboundMetadataSize(int bytes) Overrides io. Doc from io. Sets the maximum size of metadata allowed to be received. This is cumulative size of the metadata. The precise calculation is implementation-dependent, but implementations are encouraged to follow the calculation used for HTTP/2's SETTINGS_MAX_HEADER_LIST_SIZE. It sums the bytes from each entry's key and value, plus 32 bytes of overhead per entry.
| |
| permitKeepAliveTime | back to summary |
|---|---|
| public T permitKeepAliveTime(long keepAliveTime, TimeUnit timeUnit) Overrides io. Doc from io. Specify the most aggressive keep-alive time clients are permitted to configure. The server will try to detect clients exceeding this rate and when detected will forcefully close the connection. The typical default is 5 minutes when supported. 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.
| |
| permitKeepAliveWithoutCalls | back to summary |
|---|---|
| public T permitKeepAliveWithoutCalls(boolean permit) Overrides io. Doc from io. Sets whether to allow clients to send keep-alive HTTP/2 PINGs even if there are no outstanding
RPCs on the connection. Defaults to
| |
| setBinaryLog | back to summary |
|---|---|
| public T setBinaryLog(BinaryLog binaryLog) Overrides io. Doc from io. Sets the BinaryLog object that this server should log to. The server does not take
ownership of the object, and users are responsible for calling | |
| thisT | back to summary |
|---|---|
| private T thisT() Hides io. Returns the correctly typed version of the builder. | |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object. | |
| useTransportSecurity | back to summary |
|---|---|
| public T useTransportSecurity(File certChain, File privateKey) Implements abstract io. Doc from io. Makes the server use TLS. | |
| useTransportSecurity | back to summary |
|---|---|
| public T useTransportSecurity(InputStream certChain, InputStream privateKey) Overrides io. Doc from io. Makes the server use TLS.
| |