Package alluxio.grpc
Class GrpcServerBuilder
- java.lang.Object
-
- alluxio.grpc.GrpcServerBuilder
-
public final class GrpcServerBuilder extends java.lang.Object
Provides authenticated gRPC server creation.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description GrpcServerBuilder
addService(GrpcService serviceDefinition)
Add a service to this server.GrpcServerBuilder
addService(alluxio.grpc.ServiceType serviceType, GrpcService serviceDefinition)
Add a service to this server.GrpcServerBuilder
bossEventLoopGroup(io.netty.channel.EventLoopGroup bossGroup)
Sets the bossEventLoopGroup
.GrpcServer
build()
Build the server.GrpcServerBuilder
channelType(java.lang.Class<? extends io.netty.channel.ServerChannel> channelType)
Sets the netty channel type.GrpcServerBuilder
executor(java.util.concurrent.Executor executor)
Set the executor for this server.GrpcServerBuilder
flowControlWindow(int flowControlWindow)
Sets flow control window.static GrpcServerBuilder
forAddress(GrpcServerAddress serverAddress, AlluxioConfiguration conf)
Create an new instance ofGrpcServerBuilder
with authentication support.GrpcServerBuilder
intercept(io.grpc.ServerInterceptor interceptor)
Adds an interceptor for this server.GrpcServerBuilder
keepAliveTime(long keepAliveTime, java.util.concurrent.TimeUnit timeUnit)
Sets the server keep-alive time.GrpcServerBuilder
keepAliveTimeout(long keepAliveTimeout, java.util.concurrent.TimeUnit timeUnit)
Sets the server keep-alive timeout.GrpcServerBuilder
maxInboundMessageSize(int messageSize)
Sets the maximum size of inbound messages.GrpcServerBuilder
permitKeepAlive(long permitKeepAlive, java.util.concurrent.TimeUnit timeUnit)
Sets the high-bar for client-side keep-alive frequency.GrpcServerBuilder
sslContext(io.netty.handler.ssl.SslContext sslContext)
Sets TLS context.<T> GrpcServerBuilder
withChildOption(io.netty.channel.ChannelOption<T> option, T value)
Sets a netty channel option.GrpcServerBuilder
workerEventLoopGroup(io.netty.channel.EventLoopGroup workerGroup)
Sets the workerEventLoopGroup
.
-
-
-
Method Detail
-
forAddress
public static GrpcServerBuilder forAddress(GrpcServerAddress serverAddress, AlluxioConfiguration conf)
Create an new instance ofGrpcServerBuilder
with authentication support.- Parameters:
serverAddress
- server addressconf
- Alluxio configuration- Returns:
- a new instance of
GrpcServerBuilder
-
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 clienttimeUnit
- 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 connectiontimeUnit
- 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 timetimeUnit
- 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 setvalue
- the new value- Returns:
- an updated instance of this
GrpcServerBuilder
-
bossEventLoopGroup
public GrpcServerBuilder bossEventLoopGroup(io.netty.channel.EventLoopGroup bossGroup)
Sets the bossEventLoopGroup
.- 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 workerEventLoopGroup
.- 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 serviceserviceDefinition
- 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
-
-