Interface SpeculativeExecutionPolicy
-
- All Known Implementing Classes:
ConstantSpeculativeExecutionPolicy,NoSpeculativeExecutionPolicy,PercentileSpeculativeExecutionPolicy
public interface SpeculativeExecutionPolicyThe policy that decides if the driver will send speculative queries to the next hosts when the current host takes too long to respond.Note that only idempotent statements will be speculatively retried, see
Statement.isIdempotent()for more information.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceSpeculativeExecutionPolicy.SpeculativeExecutionPlanA plan that governs speculative executions for a given query.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidclose()Gets invoked at cluster shutdown.voidinit(Cluster cluster)Gets invoked at cluster startup.SpeculativeExecutionPolicy.SpeculativeExecutionPlannewPlan(String loggedKeyspace, Statement statement)Returns the plan to use for a new query.
-
-
-
Method Detail
-
init
void init(Cluster cluster)
Gets invoked at cluster startup.- Parameters:
cluster- the cluster that this policy is associated with.
-
newPlan
SpeculativeExecutionPolicy.SpeculativeExecutionPlan newPlan(String loggedKeyspace, Statement statement)
Returns the plan to use for a new query.- Parameters:
loggedKeyspace- the currently logged keyspace (the one set through eitherCluster.connect(String)or by manually doing aUSEquery) for the session on which this plan need to be built. This can benullif the corresponding session has no keyspace logged in.statement- the query for which to build a plan.- Returns:
- the plan.
-
close
void close()
Gets invoked at cluster shutdown.This gives the policy the opportunity to perform some cleanup, for instance stop threads that it might have started.
-
-