Class ReadCallback<E extends Endpoints<E>,P extends ReplicaPlan.ForRead<E,P>>

java.lang.Object
org.apache.cassandra.service.reads.ReadCallback<E,P>
All Implemented Interfaces:
RequestCallback<ReadResponse>

public class ReadCallback<E extends Endpoints<E>,P extends ReplicaPlan.ForRead<E,P>> extends Object implements RequestCallback<ReadResponse>
  • Field Details

  • Constructor Details

  • Method Details

    • replicaPlan

      protected P replicaPlan()
    • await

      public boolean await(long commandTimeout, TimeUnit unit)
    • awaitUntil

      public boolean awaitUntil(long deadline)
      In case of speculation, we want to time out the request immediately if we have _also_ hit a deadline. For example, we have a read timeout of 10s, 99% latency of 5 seconds, native_transport_timeout of 12s, and time base is QUEUE: * Request has spent 3 seconds in the queue. Here, we will wait for 2 seconds and try to speculate * Request has spent 10 seconds in the queue. Here, we will wait for 0 seconds and try to speculate If the time base is REQUEST: * Request has spent 10 seconds in the queue. Here, we will only wait 2 seconds and then try to speculate We should _not_ speculate in all these cases, since by that time we are already past request deadline.
    • awaitResults

      public void awaitResults() throws ReadFailureException, ReadTimeoutException
      Throws:
      ReadFailureException
      ReadTimeoutException
    • blockFor

      public int blockFor()
    • onResponse

      public void onResponse(Message<ReadResponse> message)
      Specified by:
      onResponse in interface RequestCallback<E extends Endpoints<E>>
      Parameters:
      message - response received.
    • response

      public void response(ReadResponse result)
    • trackLatencyForSnitch

      public boolean trackLatencyForSnitch()
      Specified by:
      trackLatencyForSnitch in interface RequestCallback<E extends Endpoints<E>>
      Returns:
      true if this callback is on the read path and its latency should be given as input to the dynamic snitch.
    • onFailure

      public void onFailure(InetAddressAndPort from, RequestFailureReason failureReason)
      Description copied from interface: RequestCallback
      Called when there is an exception on the remote node or timeout happens
      Specified by:
      onFailure in interface RequestCallback<E extends Endpoints<E>>
    • invokeOnFailure

      public boolean invokeOnFailure()
      Description copied from interface: RequestCallback
      Returns true if the callback handles failure reporting - in which case the remove host will be asked to report failures to us in the event of a problem processing the request. TODO: this is an error prone method, and we should be handling failures everywhere so we should probably just start doing that, and remove this method
      Specified by:
      invokeOnFailure in interface RequestCallback<E extends Endpoints<E>>
      Returns:
      true if the callback should be invoked on failure