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
bc52bca741
commit
6cf4fdde61
|
@ -249,7 +249,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