double getWeight(BalancerClusterState cluster) {
    boolean hasCandidate = false;

    // Candidate generation is expensive, so for re-weighing generators we will cache
    // the value for a bit
    if (EnvironmentEdgeManager.currentTime() - lastWeighedAt < WEIGHT_CACHE_TTL.toMillis()) {
      return lastWeight;
    } else {
      hasCandidate = generateCandidate(cluster, true) != BalanceAction.NULL_ACTION;
      lastWeighedAt = EnvironmentEdgeManager.currentTime();
    }

    if (hasCandidate) {
      // If this generator has something to do, then it's important
      lastWeight = CandidateGenerator.MAX_WEIGHT;
    } else {
      lastWeight = 0;
    }
    return lastWeight;
  }
Generates a balancing action to appease the conditional.
@param cluster    Current state of the cluster.
@param isWeighing Flag indicating if the generator is being used for weighing.
@return A BalanceAction, or NULL_ACTION if no action is needed.
hbase-balancer/src/main/java/org/apache/hadoop/hbase/master/balancer/RegionPlanConditionalCandidateGenerator.java