@FunctionalInterface public interface NodeDistanceEvaluator
NodeDistance
evaluator.
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.class
option).
Modifier and Type | Method and Description |
---|---|
NodeDistance |
evaluateDistance(Node node,
String localDc)
Evaluates the distance to apply to the given node.
|
@Nullable NodeDistance evaluateDistance(@NonNull Node node, @Nullable String localDc)
This method will be invoked each time the LoadBalancingPolicy
processes 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-null NodeDistance
, 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.
node
- The node to assign a new distance to.localDc
- The local datacenter name, if defined, or null otherwise.NodeDistance
to assign to the node, or null to let the policy decide.Copyright © 2017–2024. All rights reserved.