Class GrpcServerImpl

  • All Implemented Interfaces:

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

      • 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
        a completion stage of starting tryProcess
      • 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
        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
        a listen port; or -1 if unknown or the default server socket is not active
      • deploy

        public void deploy​(ServiceDescriptor serviceDescriptor,
                           PriorityBag<io.grpc.ServerInterceptor> globalInterceptors)
        Deploy the specified service to this GrpcServer.
        serviceDescriptor - the service to deploy
        globalInterceptors - the global ServerInterceptors to wrap all services with
        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.
        service - the service to undeploy
        sName - the gRPC server name
        NullPointerException - if service is null
      • getServices

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

        public io.grpc.ManagedChannel createInProcessChannel()
        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.
        tlsConfig - the ssl configuration
        an instance of SslContextBuilder