RebalancerConfig rebalancerConfig = resourceConfig.getRebalancerConfig();
RebalancerContext context = rebalancerConfig.getRebalancerContext(RebalancerContext.class);
StateModelDefinition stateModelDef = stateModelDefs.get(context.getStateModelDefId());
ResourceAssignment resourceAssignment = null;
if (rebalancerConfig != null) {
HelixRebalancer rebalancer = rebalancerConfig.getRebalancer();
HelixManager manager = event.getAttribute("helixmanager");
if (rebalancer == null) {
rebalancer = new FallbackRebalancer();
}
rebalancer.init(manager);
resourceAssignment =
rebalancer.computeResourceMapping(rebalancerConfig, cluster, currentStateOutput);
}
if (resourceAssignment == null) {
resourceAssignment =
mapDroppedResource(cluster, resourceId, currentStateOutput, stateModelDef);
} else {