Interface SpeculativeExecutionPolicy
-
- All Superinterfaces:
AutoCloseable
public interface SpeculativeExecutionPolicy extends AutoCloseable
The policy that decides if the driver will send speculative queries to the next nodes when the current node takes too long to respond.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidclose()Called when the cluster that this policy is associated with closes.longnextExecution(Node node, CqlIdentifier keyspace, Request request, int runningExecutions)
-
-
-
Method Detail
-
nextExecution
long nextExecution(@NonNull Node node, @Nullable CqlIdentifier keyspace, @NonNull Request request, int runningExecutions)- Parameters:
node- the node that caused the speculative execution (that is, the node that was queried previously but was too slow to answer)keyspace- the CQL keyspace currently associated to the session. This is set either through the configuration, by callingSessionBuilder.withKeyspace(CqlIdentifier), or by manually executing aUSECQL statement. It can benullif the session has no keyspace.request- the request to execute.runningExecutions- the number of executions that are already running (including the initial, non-speculative request). For example, if this is 2 it means the initial attempt was sent, then the driver scheduled a first speculative execution, and it is now asking for the delay until the second speculative execution.- Returns:
- the time (in milliseconds) until a speculative request is sent to the next node, or 0 to send it immediately, or a negative value to stop sending requests.
-
close
void close()
Called when the cluster that this policy is associated with closes.- Specified by:
closein interfaceAutoCloseable
-
-