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 class
BatchlogResponseHandler.BatchlogCleanup
static interface
BatchlogResponseHandler.BatchlogCleanupCallback
-
Field Summary
Fields Modifier and Type Field Description protected int
requiredBeforeFinish
-
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 int
ackCount()
protected int
blockFor()
protected int
candidateReplicaCount()
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/downvoid
get()
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.void
onFailure(InetAddressAndPort from, RequestFailureReason failureReason)
Called when there is an exception on the remote node or timeout happensvoid
onResponse(Message<T> msg)
null message means "response from local write"protected void
signal()
protected boolean
waitingFor(InetAddressAndPort from)
-
Methods inherited from class org.apache.cassandra.service.AbstractWriteResponseHandler
consistencyLevel, currentTimeoutNanos, expired, 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:
ackCount
in classAbstractWriteResponseHandler<T>
- Returns:
- number of responses received
-
onResponse
public void onResponse(Message<T> msg)
Description copied from class:AbstractWriteResponseHandler
null message means "response from local write"- Specified by:
onResponse
in interfaceRequestCallback<T>
- Specified by:
onResponse
in classAbstractWriteResponseHandler<T>
- Parameters:
msg
- response received.
-
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 interfaceRequestCallback<T>
- Overrides:
onFailure
in classAbstractWriteResponseHandler<T>
-
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 interfaceRequestCallback<T>
- Overrides:
invokeOnFailure
in classAbstractWriteResponseHandler<T>
- Returns:
- true if the callback should be invoked on failure
-
get
public void get() throws WriteTimeoutException, WriteFailureException
- Overrides:
get
in classAbstractWriteResponseHandler<T>
- Throws:
WriteTimeoutException
WriteFailureException
-
blockFor
protected int blockFor()
- Overrides:
blockFor
in classAbstractWriteResponseHandler<T>
- Returns:
- the minimum number of endpoints that must respond.
-
candidateReplicaCount
protected int candidateReplicaCount()
Description copied from class:AbstractWriteResponseHandler
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/down- Overrides:
candidateReplicaCount
in classAbstractWriteResponseHandler<T>
- Returns:
- the total number of endpoints the request can send to.
-
waitingFor
protected boolean waitingFor(InetAddressAndPort from)
- Overrides:
waitingFor
in classAbstractWriteResponseHandler<T>
- Returns:
- true if the message counts towards the blockFor() threshold
-
signal
protected void signal()
- Overrides:
signal
in classAbstractWriteResponseHandler<T>
-
-