REQ - the type of request the server expects to receive.RESP - the type of response the server will send.@ChannelHandler.Sharable
public abstract class AbstractServerHandler<REQ extends MessageBody,RESP extends MessageBody>
extends org.apache.paimon.shade.netty4.io.netty.channel.ChannelInboundHandlerAdapter
NetworkServer.| 限定符和类型 | 字段和说明 |
|---|---|
protected ExecutorService |
queryExecutor
Thread pool for query execution.
|
| 构造器和说明 |
|---|
AbstractServerHandler(NetworkServer<REQ,RESP> server,
MessageSerializer<REQ,RESP> serializer,
ServiceRequestStats stats)
Create the handler.
|
| 限定符和类型 | 方法和说明 |
|---|---|
void |
channelActive(org.apache.paimon.shade.netty4.io.netty.channel.ChannelHandlerContext ctx) |
void |
channelInactive(org.apache.paimon.shade.netty4.io.netty.channel.ChannelHandlerContext ctx) |
void |
channelRead(org.apache.paimon.shade.netty4.io.netty.channel.ChannelHandlerContext ctx,
Object msg) |
void |
exceptionCaught(org.apache.paimon.shade.netty4.io.netty.channel.ChannelHandlerContext ctx,
Throwable cause) |
protected String |
getServerName() |
abstract CompletableFuture<RESP> |
handleRequest(long requestId,
REQ request)
Handles an incoming request and returns a
CompletableFuture containing the
corresponding response. |
abstract CompletableFuture<Void> |
shutdown()
Shuts down any handler-specific resources, e.g. thread pools etc and returns a
CompletableFuture. |
channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, userEventTriggeredensureNotSharable, handlerAdded, handlerRemoved, isSharableprotected final ExecutorService queryExecutor
public AbstractServerHandler(NetworkServer<REQ,RESP> server, MessageSerializer<REQ,RESP> serializer, ServiceRequestStats stats)
serializer - the serializer used to (de-)serialize messagesstats - statistics collectorprotected String getServerName()
public void channelActive(org.apache.paimon.shade.netty4.io.netty.channel.ChannelHandlerContext ctx)
channelActive 在接口中 org.apache.paimon.shade.netty4.io.netty.channel.ChannelInboundHandlerchannelActive 在类中 org.apache.paimon.shade.netty4.io.netty.channel.ChannelInboundHandlerAdapterpublic void channelInactive(org.apache.paimon.shade.netty4.io.netty.channel.ChannelHandlerContext ctx)
channelInactive 在接口中 org.apache.paimon.shade.netty4.io.netty.channel.ChannelInboundHandlerchannelInactive 在类中 org.apache.paimon.shade.netty4.io.netty.channel.ChannelInboundHandlerAdapterpublic void channelRead(org.apache.paimon.shade.netty4.io.netty.channel.ChannelHandlerContext ctx,
Object msg)
throws Exception
channelRead 在接口中 org.apache.paimon.shade.netty4.io.netty.channel.ChannelInboundHandlerchannelRead 在类中 org.apache.paimon.shade.netty4.io.netty.channel.ChannelInboundHandlerAdapterExceptionpublic void exceptionCaught(org.apache.paimon.shade.netty4.io.netty.channel.ChannelHandlerContext ctx,
Throwable cause)
throws Exception
exceptionCaught 在接口中 org.apache.paimon.shade.netty4.io.netty.channel.ChannelHandlerexceptionCaught 在接口中 org.apache.paimon.shade.netty4.io.netty.channel.ChannelInboundHandlerexceptionCaught 在类中 org.apache.paimon.shade.netty4.io.netty.channel.ChannelInboundHandlerAdapterExceptionpublic abstract CompletableFuture<RESP> handleRequest(long requestId, REQ request)
CompletableFuture containing the
corresponding response.
NOTE: This method is called by multiple threads.
requestId - the id of the received request to be handled.request - the request to be handled.public abstract CompletableFuture<Void> shutdown()
CompletableFuture.
If an exception is thrown during the shutdown process, then that exception will be included in the returned future.
CompletableFuture that will be completed when the shutdown process actually
finishes.Copyright © 2023–2025 The Apache Software Foundation. All rights reserved.