Class RespRequestHandler

java.lang.Object
org.infinispan.server.resp.RespRequestHandler
Direct Known Subclasses:
CacheRespRequestHandler

public abstract class RespRequestHandler extends Object
  • Field Details

  • Constructor Details

    • RespRequestHandler

      public RespRequestHandler()
  • Method Details

    • initializeIfNecessary

      protected void initializeIfNecessary(io.netty.channel.ChannelHandlerContext ctx)
    • handleRequest

      public final CompletionStage<RespRequestHandler> handleRequest(io.netty.channel.ChannelHandlerContext ctx, RespCommand type, List<byte[]> arguments)
    • 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 allocatorToUse to retrieve a ByteBuffer. 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 send down stream until later in the pipeline.

      Parameters:
      ctx - Netty context pipeline for this request
      type - The command type
      arguments - 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

      protected <E> CompletionStage<RespRequestHandler> stageToReturn(CompletionStage<E> stage, io.netty.channel.ChannelHandlerContext ctx, BiConsumer<? super E,ByteBufPool> biConsumer)
    • stageToReturn

      protected <E> CompletionStage<RespRequestHandler> stageToReturn(CompletionStage<E> stage, io.netty.channel.ChannelHandlerContext ctx, Function<E,RespRequestHandler> handlerWhenComplete)
    • stringToByteBufWithExtra

      protected static io.netty.buffer.ByteBuf stringToByteBufWithExtra(CharSequence string, ByteBufPool alloc, int extraBytes)
    • stringToByteBuf

      protected static io.netty.buffer.ByteBuf stringToByteBuf(CharSequence string, ByteBufPool alloc)
    • bytesToResult

      protected static io.netty.buffer.ByteBuf bytesToResult(byte[] result, ByteBufPool alloc)
    • stringSize

      protected static int stringSize(int x)
    • setIntChars

      protected static int setIntChars(int i, int index, io.netty.buffer.ByteBuf buf)