Class Tracker

java.lang.Object
org.infinispan.server.resp.logging.Tracker

public class Tracker extends Object
Tracker for a single command.

One instance tracks one request at a time. One instance can be reutilized indefinitely for subsequent requests within the same ChannelHandlerContext but never for interleaving requests.

A request starts with a call to track(RespCommand, List), storing data about time, request size, and affected keys. The tracker is updated when the ByteBufPool needs to allocate more bytes for a response. The request stops tracking on the done(Throwable), generating an instance of AccessData.

  • Constructor Details

    • Tracker

      public Tracker(io.netty.channel.ChannelHandlerContext ctx, TimeService timeService)
  • Method Details

    • track

      public void track(RespCommand req, List<byte[]> arguments)
      Starts tracking the request.

      Only one request is tracked at a time. If this method is called while another request is being tracked, an IllegalStateException is thrown.

      Parameters:
      req - : The current request to track.
      arguments - : The request arguments.
      Throws:
      IllegalStateException - if another request is being tracked.
    • increaseBytesRequested

      public void increaseBytesRequested(int bytes)
    • done

      public AccessData done(Throwable throwable)
      Stops tracking the request.

      If this method is called while no request is being tracked, null is returned.

      Parameters:
      throwable - : If the request failed, the exception that caused the failure.
      Returns:
      An instance of AccessData if a request was being tracked, null otherwise.