Package alluxio.grpc

Class GrpcServerBuilder


  • public final class GrpcServerBuilder
    extends java.lang.Object
    Provides authenticated gRPC server creation.
    • Method Detail

      • executor

        public GrpcServerBuilder executor​(@Nullable
                                          java.util.concurrent.Executor executor)
        Set the executor for this server.
        Parameters:
        executor - the executor
        Returns:
        an updated instance of this GrpcServerBuilder
      • flowControlWindow

        public GrpcServerBuilder flowControlWindow​(int flowControlWindow)
        Sets flow control window.
        Parameters:
        flowControlWindow - the HTTP2 flow control window
        Returns:
        an updated instance of this GrpcServerBuilder
      • keepAliveTime

        public GrpcServerBuilder keepAliveTime​(long keepAliveTime,
                                               java.util.concurrent.TimeUnit timeUnit)
        Sets the server keep-alive time.
        Parameters:
        keepAliveTime - the time to wait after idle before pinging client
        timeUnit - unit of the time
        Returns:
        an updated instance of this GrpcServerBuilder
      • keepAliveTimeout

        public GrpcServerBuilder keepAliveTimeout​(long keepAliveTimeout,
                                                  java.util.concurrent.TimeUnit timeUnit)
        Sets the server keep-alive timeout.
        Parameters:
        keepAliveTimeout - time to wait after pinging client before closing the connection
        timeUnit - unit of the timeout
        Returns:
        an updated instance of this GrpcServerBuilder
      • permitKeepAlive

        public GrpcServerBuilder permitKeepAlive​(long permitKeepAlive,
                                                 java.util.concurrent.TimeUnit timeUnit)
        Sets the high-bar for client-side keep-alive frequency. Clients pushing this bar will be held back by closing their connections.
        Parameters:
        permitKeepAlive - permitted client-side keep-alive time
        timeUnit - unit of the timeout
        Returns:
        an updated instance of this GrpcServerBuilder
      • channelType

        public GrpcServerBuilder channelType​(java.lang.Class<? extends io.netty.channel.ServerChannel> channelType)
        Sets the netty channel type.
        Parameters:
        channelType - the netty channel type for the server
        Returns:
        an updated instance of this GrpcServerBuilder
      • withChildOption

        public <T> GrpcServerBuilder withChildOption​(io.netty.channel.ChannelOption<T> option,
                                                     T value)
        Sets a netty channel option.
        Type Parameters:
        T - channel option type
        Parameters:
        option - the option to be set
        value - the new value
        Returns:
        an updated instance of this GrpcServerBuilder
      • bossEventLoopGroup

        public GrpcServerBuilder bossEventLoopGroup​(io.netty.channel.EventLoopGroup bossGroup)
        Sets the boss EventLoopGroup.
        Parameters:
        bossGroup - the boss event loop group
        Returns:
        an updated instance of this GrpcServerBuilder
      • workerEventLoopGroup

        public GrpcServerBuilder workerEventLoopGroup​(io.netty.channel.EventLoopGroup workerGroup)
        Sets the worker EventLoopGroup.
        Parameters:
        workerGroup - the worker event loop group
        Returns:
        an updated instance of this GrpcServerBuilder
      • maxInboundMessageSize

        public GrpcServerBuilder maxInboundMessageSize​(int messageSize)
        Sets the maximum size of inbound messages.
        Parameters:
        messageSize - maximum size of the message
        Returns:
        an updated instance of this GrpcServerBuilder
      • addService

        public GrpcServerBuilder addService​(alluxio.grpc.ServiceType serviceType,
                                            GrpcService serviceDefinition)
        Add a service to this server.
        Parameters:
        serviceType - the type of service
        serviceDefinition - the service definition of new service
        Returns:
        an updated instance of this GrpcServerBuilder
      • addService

        public GrpcServerBuilder addService​(GrpcService serviceDefinition)
        Add a service to this server.
        Parameters:
        serviceDefinition - the service definition of new service
        Returns:
        an updated instance of this GrpcServerBuilder
      • intercept

        public GrpcServerBuilder intercept​(io.grpc.ServerInterceptor interceptor)
        Adds an interceptor for this server.
        Parameters:
        interceptor - server interceptor
        Returns:
        an updates instance of this GrpcServerBuilder
      • sslContext

        public GrpcServerBuilder sslContext​(io.netty.handler.ssl.SslContext sslContext)
        Sets TLS context.
        Parameters:
        sslContext - TLS context
        Returns:
        an updated instance of this GrpcServerBuilder
      • build

        public GrpcServer build()
        Build the server. It attaches required services and interceptors for authentication.
        Returns:
        the built GrpcServer