Interface NodeDistanceEvaluator
-
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface NodeDistanceEvaluator
A pluggableNodeDistanceevaluator.Node distance evaluators are recognized by all the driver built-in load balancing policies. They can be specified programmatically or through the configuration (with the
load-balancing-policy.evaluator.classoption).
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description NodeDistanceevaluateDistance(Node node, String localDc)Evaluates the distance to apply to the given node.
-
-
-
Method Detail
-
evaluateDistance
@Nullable NodeDistance evaluateDistance(@NonNull Node node, @Nullable String localDc)
Evaluates the distance to apply to the given node.This method will be invoked each time the
LoadBalancingPolicyprocesses a topology or state change, and will be passed the node being inspected, and the local datacenter name (or null if none is defined). If it returns a non-nullNodeDistance, the policy will suggest that distance for the node; if it returns null, the policy will assign a default distance instead, based on its internal algorithm for computing node distances.- Parameters:
node- The node to assign a new distance to.localDc- The local datacenter name, if defined, or null otherwise.- Returns:
- The
NodeDistanceto assign to the node, or null to let the policy decide.
-
-