@ChannelHandler.Sharable public class KvServerHandler extends AbstractServerHandler<KvRequest,KvResponse>
The network threads receive the message, deserialize it and dispatch the query task. The actual query is handled in a separate thread as it might otherwise block the network threads (file I/O etc.).
queryExecutor| Constructor and Description |
|---|
KvServerHandler(KvQueryServer server,
int serverId,
int numServers,
TableQuery lookup,
MessageSerializer<KvRequest,KvResponse> serializer,
ServiceRequestStats stats)
Create the handler used by the
KvQueryServer. |
| Modifier and Type | Method and Description |
|---|---|
CompletableFuture<KvResponse> |
handleRequest(long requestId,
KvRequest request)
Handles an incoming request and returns a
CompletableFuture containing the
corresponding response. |
CompletableFuture<Void> |
shutdown()
Shuts down any handler-specific resources, e.g.
|
channelActive, channelInactive, channelRead, exceptionCaught, getServerNamechannelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, userEventTriggeredensureNotSharable, handlerAdded, handlerRemoved, isSharablepublic KvServerHandler(KvQueryServer server, int serverId, int numServers, TableQuery lookup, MessageSerializer<KvRequest,KvResponse> serializer, ServiceRequestStats stats)
KvQueryServer.server - the KvQueryServer using the handler.lookup - to be queried.serializer - the MessageSerializer used to (de-) serialize the different
messages.stats - server statistics collector.public CompletableFuture<KvResponse> handleRequest(long requestId, KvRequest request)
AbstractServerHandlerCompletableFuture containing the
corresponding response.
NOTE: This method is called by multiple threads.
handleRequest in class AbstractServerHandler<KvRequest,KvResponse>requestId - the id of the received request to be handled.request - the request to be handled.public CompletableFuture<Void> shutdown()
AbstractServerHandlerCompletableFuture.
If an exception is thrown during the shutdown process, then that exception will be included in the returned future.
shutdown in class AbstractServerHandler<KvRequest,KvResponse>CompletableFuture that will be completed when the shutdown process actually
finishes.Copyright © 2023–2024 The Apache Software Foundation. All rights reserved.