HBASE-25776 Use Class.asSubclass to fix the warning in StochasticLoadBalancer.loadCustomCostFunctions (#3163)
Signed-off-by: Duo Zhang <zhangduo@apache.org> Signed-off-by: Viraj Jasani <vjasani@apache.org>
This commit is contained in:
parent
69e93c8137
commit
22fd7d7f10
|
@ -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());
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue