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 Summary
FieldsModifier and TypeFieldDescriptionprotected static final org.slf4j.Loggerfinal ResponseResolver<E,P> -
Constructor Summary
ConstructorsConstructorDescriptionReadCallback(ResponseResolver<E, P> resolver, ReadCommand command, ReplicaPlan.Shared<E, P> replicaPlan, Dispatcher.RequestTime requestTime) -
Method Summary
Modifier and TypeMethodDescriptionbooleanvoidbooleanawaitUntil(long deadline) In case of speculation, we want to time out the request immediately if we have _also_ hit a deadline.intblockFor()booleanReturns 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.voidonFailure(InetAddressAndPort from, RequestFailureReason failureReason) Called when there is an exception on the remote node or timeout happensvoidonResponse(Message<ReadResponse> message) protected Pvoidresponse(ReadResponse result) boolean
-
Field Details
-
logger
protected static final org.slf4j.Logger logger -
resolver
-
-
Constructor Details
-
Method Details
-
replicaPlan
-
await
-
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
-
blockFor
public int blockFor() -
onResponse
- Specified by:
onResponsein interfaceRequestCallback<E extends Endpoints<E>>- Parameters:
message- response received.
-
response
-
trackLatencyForSnitch
public boolean trackLatencyForSnitch()- Specified by:
trackLatencyForSnitchin interfaceRequestCallback<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
Description copied from interface:RequestCallbackCalled when there is an exception on the remote node or timeout happens- Specified by:
onFailurein interfaceRequestCallback<E extends Endpoints<E>>
-
invokeOnFailure
public boolean invokeOnFailure()Description copied from interface:RequestCallbackReturns 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:
invokeOnFailurein interfaceRequestCallback<E extends Endpoints<E>>- Returns:
- true if the callback should be invoked on failure
-