You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by vj...@apache.org on 2021/04/15 18:09:46 UTC

[hbase] branch branch-2.4 updated: HBASE-25776 Use Class.asSubclass to fix the warning in StochasticLoadBalancer.loadCustomCostFunctions (#3163)

This is an automated email from the ASF dual-hosted git repository.

vjasani pushed a commit to branch branch-2.4
in repository https://gitbox.apache.org/repos/asf/hbase.git


The following commit(s) were added to refs/heads/branch-2.4 by this push:
     new 22fd7d7  HBASE-25776 Use Class.asSubclass to fix the warning in StochasticLoadBalancer.loadCustomCostFunctions (#3163)
22fd7d7 is described below

commit 22fd7d7f10db908eb5c89cec1a81c50a1ea8bf71
Author: xiaoyu <54...@qq.com>
AuthorDate: Fri Apr 16 02:04:06 2021 +0800

    HBASE-25776 Use Class.asSubclass to fix the warning in StochasticLoadBalancer.loadCustomCostFunctions (#3163)
    
    Signed-off-by: Duo Zhang <zh...@apache.org>
    Signed-off-by: Viraj Jasani <vj...@apache.org>
---
 .../org/apache/hadoop/hbase/master/balancer/StochasticLoadBalancer.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/StochasticLoadBalancer.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/StochasticLoadBalancer.java
index 2882cdc..dd35681 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/StochasticLoadBalancer.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/StochasticLoadBalancer.java
@@ -247,7 +247,7 @@ public class StochasticLoadBalancer extends BaseLoadBalancer {
     costFunctions.addAll(Arrays.stream(functionsNames).map(c -> {
       Class<? extends CostFunction> klass = null;
       try {
-        klass = (Class<? extends CostFunction>) Class.forName(c);
+        klass = Class.forName(c).asSubclass(CostFunction.class);
       } catch (ClassNotFoundException e) {
         LOG.warn("Cannot load class " + c + "': " + e.getMessage());
       }