Package org.apache.drill.exec.rpc
Class BasicServer<T extends com.google.protobuf.Internal.EnumLite,SC extends ServerConnection<SC>>
java.lang.Object
org.apache.drill.exec.rpc.RpcBus<T,SC>
org.apache.drill.exec.rpc.BasicServer<T,SC>
- Type Parameters:
T
- RPC typeSC
- server connection type
- All Implemented Interfaces:
Closeable
,AutoCloseable
- Direct Known Subclasses:
ControlServer
,DataServer
,UserServer
public abstract class BasicServer<T extends com.google.protobuf.Internal.EnumLite,SC extends ServerConnection<SC>>
extends RpcBus<T,SC>
A server is bound to a port and is responsible for responding to various type of requests. In some cases,
the inbound requests will generate more than one outbound request.
-
Nested Class Summary
Modifier and TypeClassDescriptionprotected static class
BasicServer.ServerHandshakeHandler<T extends com.google.protobuf.MessageLite>
Nested classes/interfaces inherited from class org.apache.drill.exec.rpc.RpcBus
RpcBus.ChannelClosedHandler, RpcBus.InboundHandler
-
Field Summary
-
Constructor Summary
ConstructorDescriptionBasicServer
(RpcConfig rpcMapping, io.netty.buffer.ByteBufAllocator alloc, io.netty.channel.EventLoopGroup eventLoopGroup) -
Method Summary
Modifier and TypeMethodDescriptionint
void
close()
protected void
closeSSL()
protected abstract ProtobufLengthDecoder
getDecoder
(BufferAllocator allocator, OutOfMemoryHandler outOfMemoryHandler) protected abstract BasicServer.ServerHandshakeHandler<?>
getHandshakeHandler
(SC connection) protected OutOfMemoryHandler
protected abstract com.google.protobuf.MessageLite
getResponseDefaultInstance
(int rpcType) protected void
handle
(SC connection, int rpcType, io.netty.buffer.ByteBuf pBody, io.netty.buffer.ByteBuf dBody, ResponseSender sender) protected SC
initRemoteConnection
(io.netty.channel.socket.SocketChannel channel) protected boolean
void
setSslChannel
(io.netty.channel.Channel c) protected void
setupSSL
(io.netty.channel.ChannelPipeline pipe) Methods inherited from class org.apache.drill.exec.rpc.RpcBus
get, getCloseHandler, send, send, send, setAddresses
-
Constructor Details
-
BasicServer
public BasicServer(RpcConfig rpcMapping, io.netty.buffer.ByteBufAllocator alloc, io.netty.channel.EventLoopGroup eventLoopGroup)
-
-
Method Details
-
setupSSL
protected void setupSSL(io.netty.channel.ChannelPipeline pipe) -
isSslEnabled
protected boolean isSslEnabled() -
setSslChannel
public void setSslChannel(io.netty.channel.Channel c) -
closeSSL
protected void closeSSL() -
getOutOfMemoryHandler
-
getDecoder
protected abstract ProtobufLengthDecoder getDecoder(BufferAllocator allocator, OutOfMemoryHandler outOfMemoryHandler) -
getHandshakeHandler
-
getResponseDefaultInstance
protected abstract com.google.protobuf.MessageLite getResponseDefaultInstance(int rpcType) throws RpcException - Specified by:
getResponseDefaultInstance
in classRpcBus<T extends com.google.protobuf.Internal.EnumLite,
SC extends ServerConnection<SC>> - Throws:
RpcException
-
handle
protected void handle(SC connection, int rpcType, io.netty.buffer.ByteBuf pBody, io.netty.buffer.ByteBuf dBody, ResponseSender sender) throws RpcException - Specified by:
handle
in classRpcBus<T extends com.google.protobuf.Internal.EnumLite,
SC extends ServerConnection<SC>> - Throws:
RpcException
-
initRemoteConnection
- Specified by:
initRemoteConnection
in classRpcBus<T extends com.google.protobuf.Internal.EnumLite,
SC extends ServerConnection<SC>>
-
bind
-
close
- Throws:
IOException
-