@FunctionalInterface public interface NodeDistanceEvaluator
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
@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.
NodeDistanceto assign to the node, or null to let the policy decide.
Copyright © 2017–2021. All rights reserved.