| Constructor and Description |
|---|
ServerBuilder() |
| Modifier and Type | Method and Description |
|---|---|
abstract T |
addService(ServerServiceDefinition service)
Adds a service implementation to the handler registry.
|
abstract Server |
build()
Builds a server using the given parameters.
|
abstract T |
executor(Executor executor)
Provides a custom executor.
|
static ServerBuilder<?> |
forPort(int port) |
abstract T |
useTransportSecurity(File certChain,
File privateKey)
Makes the server use TLS.
|
public static ServerBuilder<?> forPort(int port)
public abstract T executor(@Nullable Executor 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.
public abstract T addService(ServerServiceDefinition service)
UnsupportedOperationException - if this builder does not support dynamically adding
services.public abstract T useTransportSecurity(File certChain, File privateKey)
certChain - file containing the full certificate chainprivateKey - file containing the private keypublic abstract Server build()
The returned service will not been started or be bound a port. You will need to start it
with Server.start().