T
- The type of builder used by this factory.public abstract class AbstractGrpcServerFactory<T extends io.grpc.ServerBuilder<T>> extends Object implements GrpcServerFactory
Modifier and Type | Field and Description |
---|---|
protected GrpcServerProperties |
properties |
protected List<GrpcServerConfigurer> |
serverConfigurers |
Modifier | Constructor and Description |
---|---|
protected |
AbstractGrpcServerFactory(GrpcServerProperties properties,
List<GrpcServerConfigurer> serverConfigurers)
Creates a new server factory with the given properties.
|
Modifier and Type | Method and Description |
---|---|
void |
addService(GrpcServiceDefinition service)
Adds the given grpc service definition to this factory.
|
protected void |
configure(T builder)
Configures the given server builder.
|
protected void |
configureConnectionLimits(T builder)
Configures the keep alive options that should be used by the server.
|
protected void |
configureKeepAlive(T builder)
Configures the keep alive options that should be used by the server.
|
protected void |
configureLimits(T builder)
Configures limits such as max message sizes that should be used by the server.
|
protected void |
configureSecurity(T builder)
Configures the security options that should be used by the server.
|
protected void |
configureServices(T builder)
Configures the services that should be served by the server.
|
io.grpc.Server |
createServer()
Creates a new grpc server with the stored options.
|
String |
getAddress()
Gets the IP address the created server will be bound to.
|
int |
getPort()
Gets the local port the created server will use to listen to requests.
|
protected abstract T |
newServerBuilder()
Creates a new server builder.
|
protected final GrpcServerProperties properties
protected final List<GrpcServerConfigurer> serverConfigurers
protected AbstractGrpcServerFactory(GrpcServerProperties properties, List<GrpcServerConfigurer> serverConfigurers)
properties
- The properties used to configure the server.serverConfigurers
- The server configurers to use. Can be empty.public io.grpc.Server createServer()
GrpcServerFactory
createServer
in interface GrpcServerFactory
protected abstract T newServerBuilder()
protected void configure(T builder)
GrpcServerConfigurer
instead.builder
- The server builder to configure.protected void configureServices(T builder)
builder
- The server builder to configure.protected void configureKeepAlive(T builder)
builder
- The server builder to configure.protected void configureConnectionLimits(T builder)
builder
- The server builder to configure.protected void configureSecurity(T builder)
builder
- The server builder to configure.protected void configureLimits(T builder)
builder
- The server builder to configure.public String getAddress()
GrpcServerFactory
getAddress
in interface GrpcServerFactory
public int getPort()
GrpcServerFactory
getPort
in interface GrpcServerFactory
public void addService(GrpcServiceDefinition service)
GrpcServerFactory
Note: Adding a service does not effect servers that have already been created.
addService
in interface GrpcServerFactory
service
- The service to add to the grpc server.