protected Map<Class<? extends CandidateGenerator>, CandidateGenerator>
    createCandidateGenerators(Configuration conf) {
    balancerConditionals.setConf(conf);
    Map<Class<? extends CandidateGenerator>, CandidateGenerator> candidateGenerators;
    if (balancerConditionals.isReplicaDistributionEnabled()) {
      candidateGenerators = new HashMap<>(3);
      candidateGenerators.put(RandomCandidateGenerator.class, new RandomCandidateGenerator());
      candidateGenerators.put(LoadCandidateGenerator.class, new LoadCandidateGenerator());
      candidateGenerators.put(LocalityBasedCandidateGenerator.class, localityCandidateGenerator);
    } else {
      candidateGenerators = new HashMap<>(5);
      candidateGenerators.put(RandomCandidateGenerator.class, new RandomCandidateGenerator());
      candidateGenerators.put(LoadCandidateGenerator.class, new LoadCandidateGenerator());
      candidateGenerators.put(LocalityBasedCandidateGenerator.class, localityCandidateGenerator);
      candidateGenerators.put(RegionReplicaCandidateGenerator.class,
        new RegionReplicaCandidateGenerator());
      candidateGenerators.put(RegionReplicaRackCandidateGenerator.class,
        new RegionReplicaRackCandidateGenerator());
    }
    return candidateGenerators;
  }
The constructor that pass a MetricsStochasticBalancer to BaseLoadBalancer to replace its
default MetricsBalancer
hbase-balancer/src/main/java/org/apache/hadoop/hbase/master/balancer/StochasticLoadBalancer.java