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>
public class BatchlogResponseHandler<T> extends AbstractWriteResponseHandler<T>
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classBatchlogResponseHandler.BatchlogCleanupstatic interfaceBatchlogResponseHandler.BatchlogCleanupCallback
-
Field Summary
Fields Modifier and Type Field Description protected intrequiredBeforeFinish-
Fields inherited from class org.apache.cassandra.service.AbstractWriteResponseHandler
callback, logger, replicaPlan, writeType
-
-
Constructor Summary
Constructors Constructor Description BatchlogResponseHandler(AbstractWriteResponseHandler<T> wrapped, int requiredBeforeFinish, BatchlogResponseHandler.BatchlogCleanup cleanup, Dispatcher.RequestTime requestTime)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected intackCount()protected intblockFor()protected intcandidateReplicaCount()TODO: 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()booleaninvokeOnFailure()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.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, setIdealCLResponseHandler
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.cassandra.net.RequestCallback
trackLatencyForSnitch
-
-
-
-
Constructor Detail
-
BatchlogResponseHandler
public BatchlogResponseHandler(AbstractWriteResponseHandler<T> wrapped, int requiredBeforeFinish, BatchlogResponseHandler.BatchlogCleanup cleanup, Dispatcher.RequestTime requestTime)
-
-
Method Detail
-
ackCount
protected int ackCount()
- Specified by:
ackCountin classAbstractWriteResponseHandler<T>- Returns:
- number of responses received
-
onResponse
public void onResponse(Message<T> msg)
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
public void onFailure(InetAddressAndPort from, RequestFailureReason failureReason)
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
public void get() throws WriteTimeoutException, WriteFailureException- 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
protected boolean waitingFor(InetAddressAndPort from)
- Overrides:
waitingForin classAbstractWriteResponseHandler<T>- Returns:
- true if the message counts towards the blockFor() threshold
-
signal
protected void signal()
- Overrides:
signalin classAbstractWriteResponseHandler<T>
-
-