Package org.infinispan.server.resp
Class RespRequestHandler
java.lang.Object
org.infinispan.server.resp.RespRequestHandler
- Direct Known Subclasses:
CacheRespRequestHandler
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final io.netty.util.AttributeKey
<ByteBufPool> protected final CompletionStage
<RespRequestHandler> protected final RespServer
protected ResponseWriter
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected CompletionStage
<RespRequestHandler> actualHandleRequest
(io.netty.channel.ChannelHandlerContext ctx, RespCommand type, List<byte[]> arguments) Handles the RESP request returning a stage that when complete notifies the command has completed as well as providing the request handler for subsequent commands.protected void
void
handleChannelDisconnect
(io.netty.channel.ChannelHandlerContext ctx) handleRequest
(io.netty.channel.ChannelHandlerContext ctx, RespCommand command, List<byte[]> arguments) protected void
initializeIfNecessary
(io.netty.channel.ChannelHandlerContext ctx) myStage()
stageToReturn
(CompletionStage<E> stage, io.netty.channel.ChannelHandlerContext ctx, BiConsumer<? super E, ResponseWriter> biConsumer) stageToReturn
(CompletionStage<E> stage, io.netty.channel.ChannelHandlerContext ctx, Function<E, RespRequestHandler> handlerWhenComplete) stageToReturn
(CompletionStage<RespRequestHandler> stage, io.netty.channel.ChannelHandlerContext ctx) writer()
-
Field Details
-
myStage
-
respServer
-
writer
-
BYTE_BUF_POOL_ATTRIBUTE_KEY
-
-
Constructor Details
-
RespRequestHandler
-
-
Method Details
-
initializeIfNecessary
protected void initializeIfNecessary(io.netty.channel.ChannelHandlerContext ctx) -
respServer
-
myStage
-
writer
-
handleRequest
public final CompletionStage<RespRequestHandler> handleRequest(io.netty.channel.ChannelHandlerContext ctx, RespCommand command, List<byte[]> arguments) -
commandNotFound
protected void commandNotFound() -
actualHandleRequest
protected CompletionStage<RespRequestHandler> actualHandleRequest(io.netty.channel.ChannelHandlerContext ctx, RespCommand type, List<byte[]> arguments) Handles the RESP request returning a stage that when complete notifies the command has completed as well as providing the request handler for subsequent commands.Implementations should never use the ByteBufAllocator in the context. Instead, they should use
writer
to retrieve aResponseWriter
This ByteBuffer should only have bytes written to it adding up to the size requested. The ByteBuffer itself should never be written to the context or channel and flush should also never be invoked. Failure to do so may cause mis-ordering or responses as requests support pipelining and a ByteBuf may not be sent down stream until later in the pipeline.- Parameters:
ctx
- Netty context pipeline for this requesttype
- The command typearguments
- The remaining arguments to the command- Returns:
- stage that when complete returns the new handler to instate. This stage must be completed on the event loop
-
handleChannelDisconnect
public void handleChannelDisconnect(io.netty.channel.ChannelHandlerContext ctx) -
stageToReturn
public <E> CompletionStage<RespRequestHandler> stageToReturn(CompletionStage<E> stage, io.netty.channel.ChannelHandlerContext ctx, BiConsumer<? super E, ResponseWriter> biConsumer) -
stageToReturn
public <E> CompletionStage<RespRequestHandler> stageToReturn(CompletionStage<E> stage, io.netty.channel.ChannelHandlerContext ctx, Function<E, RespRequestHandler> handlerWhenComplete) -
stageToReturn
public CompletionStage<RespRequestHandler> stageToReturn(CompletionStage<RespRequestHandler> stage, io.netty.channel.ChannelHandlerContext ctx)
-