public abstract class AbstractWriteResponseHandler<T> extends java.lang.Object implements RequestCallback<T>
Modifier and Type | Field and Description |
---|---|
protected java.lang.Runnable |
callback |
protected static org.slf4j.Logger |
logger |
protected ReplicaPlan.ForWrite |
replicaPlan |
protected WriteType |
writeType |
Modifier | Constructor and Description |
---|---|
protected |
AbstractWriteResponseHandler(ReplicaPlan.ForWrite replicaPlan,
java.lang.Runnable callback,
WriteType writeType,
java.util.function.Supplier<Mutation> hintOnFailure,
long queryStartNanoTime) |
Modifier and Type | Method and Description |
---|---|
protected abstract 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/down
|
ConsistencyLevel |
consistencyLevel() |
long |
currentTimeoutNanos() |
void |
expired() |
void |
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.
|
protected void |
logResponseToIdealCLDelegate(Message<T> m)
This logs the response but doesn't do any further processing related to this write response handler
on whether the CL was achieved.
|
void |
maybeTryAdditionalReplicas(IMutation mutation,
StorageProxy.WritePerformer writePerformer,
java.lang.String localDC)
Cheap Quorum backup.
|
void |
onFailure(InetAddressAndPort from,
RequestFailureReason failureReason)
Called when there is an exception on the remote node or timeout happens
|
abstract void |
onResponse(Message<T> msg)
null message means "response from local write"
|
void |
setIdealCLResponseHandler(AbstractWriteResponseHandler handler)
Set a delegate ideal CL write response handler.
|
protected void |
signal() |
protected boolean |
waitingFor(InetAddressAndPort from) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
trackLatencyForSnitch
protected static final org.slf4j.Logger logger
protected final ReplicaPlan.ForWrite replicaPlan
protected final java.lang.Runnable callback
protected final WriteType writeType
protected AbstractWriteResponseHandler(ReplicaPlan.ForWrite replicaPlan, java.lang.Runnable callback, WriteType writeType, java.util.function.Supplier<Mutation> hintOnFailure, long queryStartNanoTime)
callback
- A callback to be called when the write is successful.hintOnFailure
- queryStartNanoTime
- public void get() throws WriteTimeoutException, WriteFailureException
public final long currentTimeoutNanos()
public void setIdealCLResponseHandler(AbstractWriteResponseHandler handler)
protected final void logResponseToIdealCLDelegate(Message<T> m)
public final void expired()
protected int blockFor()
protected int candidateReplicaCount()
public ConsistencyLevel consistencyLevel()
protected boolean waitingFor(InetAddressAndPort from)
protected abstract int ackCount()
public abstract void onResponse(Message<T> msg)
onResponse
in interface RequestCallback<T>
msg
- response received.protected void signal()
public void onFailure(InetAddressAndPort from, RequestFailureReason failureReason)
RequestCallback
onFailure
in interface RequestCallback<T>
public boolean invokeOnFailure()
RequestCallback
invokeOnFailure
in interface RequestCallback<T>
public void maybeTryAdditionalReplicas(IMutation mutation, StorageProxy.WritePerformer writePerformer, java.lang.String localDC)
Copyright © 2009-2022 The Apache Software Foundation