Class GrpcServerImpl

java.lang.Object
io.helidon.grpc.server.GrpcServerImpl
All Implemented Interfaces:
GrpcServer

public class GrpcServerImpl extends Object implements GrpcServer
A gRPC Server implementation.
  • Method Details

    • start

      public CompletionStage<GrpcServer> start()
      Description copied from interface: GrpcServer
      Starts the server. Has no effect if server is running.
      Specified by:
      start in interface GrpcServer
      Returns:
      a completion stage of starting process
    • shutdown

      public CompletionStage<GrpcServer> shutdown()
      Description copied from interface: GrpcServer
      Attempt to gracefully shutdown server. It is possible to use returned CompletionStage to react.

      RequestMethod can be called periodically.

      Specified by:
      shutdown in interface GrpcServer
      Returns:
      to react on finished shutdown process
      See Also:
    • configuration

      public GrpcServerConfiguration configuration()
      Description copied from interface: GrpcServer
      Gets effective server configuration.
      Specified by:
      configuration in interface GrpcServer
      Returns:
      Server configuration
    • context

      public Context context()
      Description copied from interface: GrpcServer
      Gets a GrpcServer context.
      Specified by:
      context in interface GrpcServer
      Returns:
      a server context
    • whenShutdown

      public CompletionStage<GrpcServer> whenShutdown()
      Description copied from interface: GrpcServer
      Completion stage is completed when server is shut down.
      Specified by:
      whenShutdown in interface GrpcServer
      Returns:
      a completion stage of the server
    • isRunning

      public boolean isRunning()
      Description copied from interface: GrpcServer
      Returns true if the server is currently running. A running server in the stopping phase returns true until it is fully stopped.
      Specified by:
      isRunning in interface GrpcServer
      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 interface GrpcServer
      Returns:
      a listen port; or -1 if unknown or the default server socket is not active
    • healthChecks

      public HealthCheck[] healthChecks()
      Description copied from interface: GrpcServer
      Return an array of health checks for this server.
      Specified by:
      healthChecks in interface GrpcServer
      Returns:
      an array of HealthCheck instances for this server
    • services

      public Map<String,ServiceDescriptor> services()
      Description copied from interface: GrpcServer
      Obtain the deployed services.
      Specified by:
      services in interface GrpcServer
      Returns:
      an immutable Map of deployed ServiceDescriptors keyed by service name
    • deploy

      public void deploy(ServiceDescriptor serviceDescriptor, PriorityBag<io.grpc.ServerInterceptor> globalInterceptors)
      Deploy the specified service to this GrpcServer.
      Parameters:
      serviceDescriptor - the service to deploy
      globalInterceptors - the global ServerInterceptors to wrap all services with
      Throws:
      NullPointerException - if any of the parameters is null
    • undeploy

      public void undeploy(io.grpc.BindableService service, String sName)
      Undeploy the specified BindableService from this GrpcServerImpl.
      Parameters:
      service - the service to undeploy
      sName - the gRPC server name
      Throws:
      NullPointerException - if service is null
    • getServices

      public List<io.grpc.ServerServiceDefinition> getServices()
      Obtain an immutable List of registered ServerServiceDefinitions.
      Returns:
      an immutable List of registered ServerServiceDefinitions
    • createInProcessChannel

      public io.grpc.ManagedChannel createInProcessChannel()
      Returns:
      a new in-process ManagedChannel for interacting with the services managed by this GrpcServerImpl.
    • sslContextBuilder

      protected io.netty.handler.ssl.SslContextBuilder sslContextBuilder(GrpcTlsDescriptor tlsConfig)
      Return an instance of SslContextBuilder from the specified SslConfig.
      Parameters:
      tlsConfig - the ssl configuration
      Returns:
      an instance of SslContextBuilder