java.lang.Object
io.helidon.grpc.server.GrpcServerImpl
- All Implemented Interfaces:
GrpcServer
A gRPC Server implementation.
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.helidon.grpc.server.GrpcServer
GrpcServer.Builder
-
Method Summary
Modifier and TypeMethodDescriptionGets effective server configuration.context()
Gets aGrpcServer
context.io.grpc.ManagedChannel
void
deploy
(ServiceDescriptor serviceDescriptor, PriorityBag<io.grpc.ServerInterceptor> globalInterceptors) Deploy the specifiedservice
to thisGrpcServer
.List<io.grpc.ServerServiceDefinition>
Obtain an immutableList
of registeredServerServiceDefinition
s.Return an array of health checks for this server.boolean
Returnstrue
if the server is currently running.int
port()
Returns a port number the default server socket is bound to and is listening on; or-1
if unknown or not active.services()
Obtain the deployed services.shutdown()
Attempt to gracefully shutdown server.protected io.netty.handler.ssl.SslContextBuilder
sslContextBuilder
(GrpcTlsDescriptor tlsConfig) Return an instance of SslContextBuilder from the specified SslConfig.start()
Starts the server.void
Undeploy the specifiedBindableService
from thisGrpcServerImpl
.Completion stage is completed when server is shut down.
-
Method Details
-
start
Description copied from interface:GrpcServer
Starts the server. Has no effect if server is running.- Specified by:
start
in interfaceGrpcServer
- Returns:
- a completion stage of starting process
-
shutdown
Description copied from interface:GrpcServer
Attempt to gracefully shutdown server. It is possible to use returnedCompletionStage
to react.RequestMethod can be called periodically.
- Specified by:
shutdown
in interfaceGrpcServer
- Returns:
- to react on finished shutdown process
- See Also:
-
configuration
Description copied from interface:GrpcServer
Gets effective server configuration.- Specified by:
configuration
in interfaceGrpcServer
- Returns:
- Server configuration
-
context
Description copied from interface:GrpcServer
Gets aGrpcServer
context.- Specified by:
context
in interfaceGrpcServer
- Returns:
- a server context
-
whenShutdown
Description copied from interface:GrpcServer
Completion stage is completed when server is shut down.- Specified by:
whenShutdown
in interfaceGrpcServer
- Returns:
- a completion stage of the server
-
isRunning
public boolean isRunning()Description copied from interface:GrpcServer
Returnstrue
if the server is currently running. A running server in the stopping phase returnstrue
until it is fully stopped.- Specified by:
isRunning
in interfaceGrpcServer
- Returns:
true
if server is running
-
port
public int port()Description copied from interface:GrpcServer
Returns a port number the default server socket is bound to and is listening on; or-1
if unknown or not active.Only supported only when server is running.
- Specified by:
port
in interfaceGrpcServer
- Returns:
- a listen port; or
-1
if unknown or the default server socket is not active
-
healthChecks
Description copied from interface:GrpcServer
Return an array of health checks for this server.- Specified by:
healthChecks
in interfaceGrpcServer
- Returns:
- an array of
HealthCheck
instances for this server
-
services
Description copied from interface:GrpcServer
Obtain the deployed services.- Specified by:
services
in interfaceGrpcServer
- Returns:
- an immutable
Map
of deployedServiceDescriptor
s keyed by service name
-
deploy
public void deploy(ServiceDescriptor serviceDescriptor, PriorityBag<io.grpc.ServerInterceptor> globalInterceptors) Deploy the specifiedservice
to thisGrpcServer
.- Parameters:
serviceDescriptor
- the service to deployglobalInterceptors
- the globalServerInterceptor
s to wrap all services with- Throws:
NullPointerException
- if any of the parameters isnull
-
undeploy
Undeploy the specifiedBindableService
from thisGrpcServerImpl
.- Parameters:
service
- the service to undeploysName
- the gRPC server name- Throws:
NullPointerException
- ifservice
isnull
-
getServices
Obtain an immutableList
of registeredServerServiceDefinition
s.- Returns:
- an immutable
List
of registeredServerServiceDefinition
s
-
createInProcessChannel
public io.grpc.ManagedChannel createInProcessChannel()- Returns:
- a new in-process
ManagedChannel
for interacting with the services managed by thisGrpcServerImpl
.
-
sslContextBuilder
Return an instance of SslContextBuilder from the specified SslConfig.- Parameters:
tlsConfig
- the ssl configuration- Returns:
- an instance of SslContextBuilder
-