Interface RequestCallback<T>

All Known Subinterfaces:
RequestCallbackWithFailure<T>
All Known Implementing Classes:
AbstractPaxosCallback, AbstractWriteResponseHandler, AsyncOneResponse, BatchlogResponseHandler, BlockingPartitionRepair, DatacenterSyncWriteResponseHandler, DatacenterWriteResponseHandler, FailureRecordingCallback, PaxosCleanupComplete, PaxosCleanupSession, PaxosCommit, PaxosFinishPrepareCleanup, PaxosPrepare, PaxosPrepareRefresh, PaxosPropose, PaxosRequestCallback, PaxosStartPrepareCleanup, PrepareCallback, ProposeCallback, ReadCallback, TruncateResponseHandler, WriteResponseHandler

public interface RequestCallback<T>
implementors of RequestCallback need to make sure that any public methods are threadsafe with respect to onResponse(org.apache.cassandra.net.Message<T>) being called from the message service. In particular, if any shared state is referenced, making response alone synchronized will not suffice.
  • Method Details

    • onResponse

      void onResponse(Message<T> msg)
      Parameters:
      msg - response received.
    • onFailure

      default void onFailure(InetAddressAndPort from, RequestFailureReason failureReason)
      Called when there is an exception on the remote node or timeout happens
    • invokeOnFailure

      default boolean invokeOnFailure()
      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
      Returns:
      true if the callback should be invoked on failure
    • trackLatencyForSnitch

      default boolean trackLatencyForSnitch()
      Returns:
      true if this callback is on the read path and its latency should be given as input to the dynamic snitch.
    • isTimeout

      static boolean isTimeout(Map<InetAddressAndPort,RequestFailureReason> failureReasonByEndpoint)