sunhelly commented on a change in pull request #4258:
URL: https://github.com/apache/hbase/pull/4258#discussion_r832931139



##########
File path: 
hbase-balancer/src/main/java/org/apache/hadoop/hbase/master/balancer/StochasticLoadBalancer.java
##########
@@ -166,37 +178,37 @@ public StochasticLoadBalancer(MetricsStochasticBalancer 
metricsStochasticBalance
     super(metricsStochasticBalancer);
   }
 
-  private static CostFunction createCostFunction(Class<? extends CostFunction> 
clazz,
-    Configuration conf) {
-    try {
-      Constructor<? extends CostFunction> ctor = 
clazz.getDeclaredConstructor(Configuration.class);
-      return ReflectionUtils.instantiate(clazz.getName(), ctor, conf);
-    } catch (NoSuchMethodException e) {
-      // will try construct with no parameter
-    }
-    return ReflectionUtils.newInstance(clazz);
-  }
-
-  private void loadCustomCostFunctions(Configuration conf) {
-    String[] functionsNames = 
conf.getStrings(COST_FUNCTIONS_COST_FUNCTIONS_KEY);
+  private <T> List<? extends T> loadFunctions(Configuration conf, String 
configName) {

Review comment:
       I reused this function to load the ClusterStatusBalanceChecker classes, 
which I designed as a chain of checkers to confirm if the balancer needs coarse 
costs calculations. Though currently I only add a new OverallSkewChecker, I 
think there are more possibilities, e.g. OverallHighLoadChecker, which can 
choose those high load tables and balance them first using the coarse cost 
functions. Thanks.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to