Package org.apache.cassandra.service
Class BatchlogResponseHandler<T>
java.lang.Object
org.apache.cassandra.service.AbstractWriteResponseHandler<T>
org.apache.cassandra.service.BatchlogResponseHandler<T>
- All Implemented Interfaces:
RequestCallback<T>
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic interface -
Field Summary
FieldsFields inherited from class org.apache.cassandra.service.AbstractWriteResponseHandler
callback, logger, replicaPlan, writeType -
Constructor Summary
ConstructorsConstructorDescriptionBatchlogResponseHandler(AbstractWriteResponseHandler<T> wrapped, int requiredBeforeFinish, BatchlogResponseHandler.BatchlogCleanup cleanup, Dispatcher.RequestTime requestTime) -
Method Summary
Modifier and TypeMethodDescriptionprotected intackCount()protected intblockFor()protected intTODO: this method is brittle for its purpose of deciding when we should fail a query; this needs to be aware of which nodes are live/downvoidget()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<T> msg) null message means "response from local write"protected voidsignal()protected booleanwaitingFor(InetAddressAndPort from) Methods inherited from class org.apache.cassandra.service.AbstractWriteResponseHandler
consistencyLevel, currentTimeoutNanos, expired, getRequestTime, logFailureOrTimeoutToIdealCLDelegate, logResponseToIdealCLDelegate, maybeTryAdditionalReplicas, setIdealCLResponseHandlerMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.cassandra.net.RequestCallback
trackLatencyForSnitch
-
Field Details
-
requiredBeforeFinish
protected volatile int requiredBeforeFinish
-
-
Constructor Details
-
BatchlogResponseHandler
public BatchlogResponseHandler(AbstractWriteResponseHandler<T> wrapped, int requiredBeforeFinish, BatchlogResponseHandler.BatchlogCleanup cleanup, Dispatcher.RequestTime requestTime)
-
-
Method Details
-
ackCount
protected int ackCount()- Specified by:
ackCountin classAbstractWriteResponseHandler<T>- Returns:
- number of responses received
-
onResponse
Description copied from class:AbstractWriteResponseHandlernull message means "response from local write"- Specified by:
onResponsein interfaceRequestCallback<T>- Specified by:
onResponsein classAbstractWriteResponseHandler<T>- Parameters:
msg- response received.
-
onFailure
Description copied from interface:RequestCallbackCalled when there is an exception on the remote node or timeout happens- Specified by:
onFailurein interfaceRequestCallback<T>- Overrides:
onFailurein classAbstractWriteResponseHandler<T>
-
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<T>- Overrides:
invokeOnFailurein classAbstractWriteResponseHandler<T>- Returns:
- true if the callback should be invoked on failure
-
get
- Overrides:
getin classAbstractWriteResponseHandler<T>- Throws:
WriteTimeoutExceptionWriteFailureException
-
blockFor
protected int blockFor()- Overrides:
blockForin classAbstractWriteResponseHandler<T>- Returns:
- the minimum number of endpoints that must respond.
-
candidateReplicaCount
protected int candidateReplicaCount()Description copied from class:AbstractWriteResponseHandlerTODO: this method is brittle for its purpose of deciding when we should fail a query; this needs to be aware of which nodes are live/down- Overrides:
candidateReplicaCountin classAbstractWriteResponseHandler<T>- Returns:
- the total number of endpoints the request can send to.
-
waitingFor
- Overrides:
waitingForin classAbstractWriteResponseHandler<T>- Returns:
- true if the message counts towards the blockFor() threshold
-
signal
protected void signal()- Overrides:
signalin classAbstractWriteResponseHandler<T>
-