Interface NodeDistanceEvaluator

    • 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 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.

        Parameters:
        node - The node to assign a new distance to.
        localDc - The local datacenter name, if defined, or null otherwise.
        Returns:
        The NodeDistance to assign to the node, or null to let the policy decide.