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 aGrpcServercontext.io.grpc.ManagedChannelvoiddeploy(ServiceDescriptor serviceDescriptor, PriorityBag<io.grpc.ServerInterceptor> globalInterceptors) Deploy the specifiedserviceto thisGrpcServer.List<io.grpc.ServerServiceDefinition>Obtain an immutableListof registeredServerServiceDefinitions.Return an array of health checks for this server.booleanReturnstrueif the server is currently running.intport()Returns a port number the default server socket is bound to and is listening on; or-1if unknown or not active.services()Obtain the deployed services.shutdown()Attempt to gracefully shutdown server.protected io.netty.handler.ssl.SslContextBuildersslContextBuilder(GrpcTlsDescriptor tlsConfig) Return an instance of SslContextBuilder from the specified SslConfig.start()Starts the server.voidUndeploy the specifiedBindableServicefrom thisGrpcServerImpl.Completion stage is completed when server is shut down.
-
Method Details
-
start
Description copied from interface:GrpcServerStarts the server. Has no effect if server is running.- Specified by:
startin interfaceGrpcServer- Returns:
- a completion stage of starting process
-
shutdown
Description copied from interface:GrpcServerAttempt to gracefully shutdown server. It is possible to use returnedCompletionStageto react.RequestMethod can be called periodically.
- Specified by:
shutdownin interfaceGrpcServer- Returns:
- to react on finished shutdown process
- See Also:
-
configuration
Description copied from interface:GrpcServerGets effective server configuration.- Specified by:
configurationin interfaceGrpcServer- Returns:
- Server configuration
-
context
Description copied from interface:GrpcServerGets aGrpcServercontext.- Specified by:
contextin interfaceGrpcServer- Returns:
- a server context
-
whenShutdown
Description copied from interface:GrpcServerCompletion stage is completed when server is shut down.- Specified by:
whenShutdownin interfaceGrpcServer- Returns:
- a completion stage of the server
-
isRunning
public boolean isRunning()Description copied from interface:GrpcServerReturnstrueif the server is currently running. A running server in the stopping phase returnstrueuntil it is fully stopped.- Specified by:
isRunningin interfaceGrpcServer- Returns:
trueif server is running
-
port
public int port()Description copied from interface:GrpcServerReturns a port number the default server socket is bound to and is listening on; or-1if unknown or not active.Only supported only when server is running.
- Specified by:
portin interfaceGrpcServer- Returns:
- a listen port; or
-1if unknown or the default server socket is not active
-
healthChecks
Description copied from interface:GrpcServerReturn an array of health checks for this server.- Specified by:
healthChecksin interfaceGrpcServer- Returns:
- an array of
HealthCheckinstances for this server
-
services
Description copied from interface:GrpcServerObtain the deployed services.- Specified by:
servicesin interfaceGrpcServer- Returns:
- an immutable
Mapof deployedServiceDescriptors keyed by service name
-
deploy
public void deploy(ServiceDescriptor serviceDescriptor, PriorityBag<io.grpc.ServerInterceptor> globalInterceptors) Deploy the specifiedserviceto thisGrpcServer.- Parameters:
serviceDescriptor- the service to deployglobalInterceptors- the globalServerInterceptors to wrap all services with- Throws:
NullPointerException- if any of the parameters isnull
-
undeploy
Undeploy the specifiedBindableServicefrom thisGrpcServerImpl.- Parameters:
service- the service to undeploysName- the gRPC server name- Throws:
NullPointerException- ifserviceisnull
-
getServices
Obtain an immutableListof registeredServerServiceDefinitions.- Returns:
- an immutable
Listof registeredServerServiceDefinitions
-
createInProcessChannel
public io.grpc.ManagedChannel createInProcessChannel()- Returns:
- a new in-process
ManagedChannelfor 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
-