T - The type of the subclass extending this abstract class.@ExperimentalApi(value="https://github.com/grpc/grpc-java/issues/7393") public abstract class ForwardingServerBuilder<T extends ServerBuilder<T>> extends ServerBuilder<T>
ServerBuilder that delegates all its builder methods to another builder by default.| Modifier | Constructor and Description | 
|---|---|
protected  | 
ForwardingServerBuilder()
The default constructor. 
 | 
| Modifier and Type | Method and Description | 
|---|---|
T | 
addService(BindableService bindableService)
Adds a service implementation to the handler registry. 
 | 
T | 
addService(ServerServiceDefinition service)
Adds a service implementation to the handler registry. 
 | 
T | 
addStreamTracerFactory(ServerStreamTracer.Factory factory)
Adds a  
ServerStreamTracer.Factory to measure server-side traffic. | 
T | 
addTransportFilter(ServerTransportFilter filter)
Adds a  
ServerTransportFilter. | 
Server | 
build()
Returns the  
Server built by the delegate by default. | 
T | 
callExecutor(ServerCallExecutorSupplier executorSupplier)
Allows for defining a way to provide a custom executor to handle the server call. 
 | 
T | 
compressorRegistry(CompressorRegistry registry)
Set the compression registry for use in the channel. 
 | 
T | 
decompressorRegistry(DecompressorRegistry registry)
Set the decompression registry for use in the channel. 
 | 
protected abstract ServerBuilder<?> | 
delegate()
Returns the delegated  
ServerBuilder. | 
T | 
directExecutor()
Execute application code directly in the transport thread. 
 | 
T | 
executor(Executor executor)
Provides a custom executor. 
 | 
T | 
fallbackHandlerRegistry(HandlerRegistry fallbackRegistry)
Sets a fallback handler registry that will be looked up in if a method is not found in the
 primary registry. 
 | 
static ServerBuilder<?> | 
forPort(int port)
This method serves to force sub classes to "hide" this static factory. 
 | 
T | 
handshakeTimeout(long timeout,
                TimeUnit unit)
Sets the permitted time for new connections to complete negotiation handshakes before being
 killed. 
 | 
T | 
intercept(ServerInterceptor interceptor)
Adds a  
ServerInterceptor that is run for all services on the server. | 
T | 
maxInboundMessageSize(int bytes)
Sets the maximum message size allowed to be received on the server. 
 | 
T | 
maxInboundMetadataSize(int bytes)
Sets the maximum size of metadata allowed to be received. 
 | 
T | 
setBinaryLog(BinaryLog binaryLog)
Sets the BinaryLog object that this server should log to. 
 | 
String | 
toString()  | 
T | 
useTransportSecurity(File certChain,
                    File privateKey)
Makes the server use TLS. 
 | 
T | 
useTransportSecurity(InputStream certChain,
                    InputStream privateKey)
Makes the server use TLS. 
 | 
addServicesprotected ForwardingServerBuilder()
public static ServerBuilder<?> forPort(int port)
protected abstract ServerBuilder<?> delegate()
ServerBuilder.public T directExecutor()
ServerBuilderDepending 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 ServerBuilder.executor(Executor) and
 passing in a direct executor. However, this is the preferred way as it may allow the transport
 to perform special optimizations.
directExecutor in class ServerBuilder<T extends ServerBuilder<T>>public T executor(@Nullable Executor executor)
ServerBuilderIt'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.
executor in class ServerBuilder<T extends ServerBuilder<T>>public T callExecutor(ServerCallExecutorSupplier executorSupplier)
ServerBuilderServerCallExecutorSupplier.getExecutor(ServerCall, Metadata) per RPC.
 It's an optional parameter. If it is provided, the ServerBuilder.executor(Executor) would still
 run necessary tasks before the ServerCallExecutorSupplier is ready to be called, then
 it switches over. But if calling ServerCallExecutorSupplier returns null, the server
 call is still handled by the default ServerBuilder.executor(Executor) as a fallback.
callExecutor in class ServerBuilder<T extends ServerBuilder<T>>executorSupplier - the server call executor providerpublic T addService(ServerServiceDefinition service)
ServerBuilderaddService in class ServerBuilder<T extends ServerBuilder<T>>service - ServerServiceDefinition objectpublic T addService(BindableService bindableService)
ServerBuilderaddService in class ServerBuilder<T extends ServerBuilder<T>>bindableService - BindableService objectpublic T intercept(ServerInterceptor interceptor)
ServerBuilderServerInterceptor that is run for all services on the server.  Interceptors
 added through this method always run before per-service interceptors added through ServerInterceptors.  Interceptors run in the reverse order in which they are added, just as
 with consecutive calls to ServerInterceptors.intercept().intercept in class ServerBuilder<T extends ServerBuilder<T>>interceptor - the all-service interceptorpublic T addTransportFilter(ServerTransportFilter filter)
ServerBuilderServerTransportFilter. The order of filters being added is the order they will
 be executed.addTransportFilter in class ServerBuilder<T extends ServerBuilder<T>>public T addStreamTracerFactory(ServerStreamTracer.Factory factory)
ServerBuilderServerStreamTracer.Factory to measure server-side traffic.  The order of
 factories being added is the order they will be executed.addStreamTracerFactory in class ServerBuilder<T extends ServerBuilder<T>>public T fallbackHandlerRegistry(@Nullable HandlerRegistry fallbackRegistry)
ServerBuilderaddService()) is faster but
 immutable. The fallback registry is more flexible and allows implementations to mutate over
 time and load services on-demand.fallbackHandlerRegistry in class ServerBuilder<T extends ServerBuilder<T>>public T useTransportSecurity(File certChain, File privateKey)
ServerBuilderuseTransportSecurity in class ServerBuilder<T extends ServerBuilder<T>>certChain - file containing the full certificate chainprivateKey - file containing the private keypublic T useTransportSecurity(InputStream certChain, InputStream privateKey)
ServerBuilderuseTransportSecurity in class ServerBuilder<T extends ServerBuilder<T>>certChain - InputStream containing the full certificate chainprivateKey - InputStream containing the private keypublic T decompressorRegistry(@Nullable DecompressorRegistry registry)
ServerBuilderDecompressorRegistry.getDefaultInstance.decompressorRegistry in class ServerBuilder<T extends ServerBuilder<T>>public T compressorRegistry(@Nullable CompressorRegistry registry)
ServerBuilderCompressorRegistry.getDefaultInstance.compressorRegistry in class ServerBuilder<T extends ServerBuilder<T>>public T handshakeTimeout(long timeout, TimeUnit unit)
ServerBuilderhandshakeTimeout in class ServerBuilder<T extends ServerBuilder<T>>public T maxInboundMessageSize(int bytes)
ServerBuilderThis method is advisory, and implementations may decide to not enforce this.  Currently,
 the only known transport to not enforce this is InProcessServer.
maxInboundMessageSize in class ServerBuilder<T extends ServerBuilder<T>>bytes - the maximum number of bytes a single message can be.public T maxInboundMetadataSize(int bytes)
ServerBuilderInteger.MAX_VALUE disables
 the enforcement. The default is implementation-dependent, but is not generally less than 8 KiB
 and may be unlimited.
 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.
maxInboundMetadataSize in class ServerBuilder<T extends ServerBuilder<T>>bytes - the maximum size of received metadatapublic T setBinaryLog(BinaryLog binaryLog)
ServerBuilderCloseable.close().setBinaryLog in class ServerBuilder<T extends ServerBuilder<T>>binaryLog - the object to provide logging.public Server build()
Server built by the delegate by default. Overriding method can return
 different value.build in class ServerBuilder<T extends ServerBuilder<T>>