Class GrpcServerImpl

  • All Implemented Interfaces:
    GrpcServer

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

      • 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
      • 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