use of com.alibaba.jstorm.daemon.supervisor.SupervisorInfo in project jstorm by alibaba.
the class WorkerScheduler method getAvailableWorkersNum.
private int getAvailableWorkersNum(DefaultTopologyAssignContext context) {
Map<String, SupervisorInfo> supervisors = context.getCluster();
List<SupervisorInfo> isolationSupervisors = this.getIsolationSupervisors(context);
int slotNum = 0;
if (isolationSupervisors.size() != 0) {
for (SupervisorInfo superivsor : isolationSupervisors) {
slotNum = slotNum + superivsor.getAvailableWorkerPorts().size();
}
} else {
for (Entry<String, SupervisorInfo> entry : supervisors.entrySet()) {
slotNum = slotNum + entry.getValue().getAvailableWorkerPorts().size();
}
}
return slotNum;
}
Aggregations