public void addStepSplits(StepExecution masterStepExecution, String remoteStepName,
Set<StepExecution> stepExecutions, Map<StepExecution, ContainerRequestHint> resourceRequests) {
// from request data we get hints where container should be run.
// find a well distributed union of hosts.
ContainerAllocateData containerAllocateData = new ContainerAllocateData();
int countNeeded = 0;
HashSet<String> hostUnion = new HashSet<String>();
for (Entry<StepExecution, ContainerRequestHint> entry : resourceRequests.entrySet()) {
StepExecution se = entry.getKey();
ContainerRequestHint crd = entry.getValue();
requestData.put(se, crd);
remoteStepNames.put(se, remoteStepName);
countNeeded++;
for (String host : crd.getHosts()) {
hostUnion.add(host);
}
}
while (countNeeded > 0) {
Iterator<String> iterator = hostUnion.iterator();
while (countNeeded > 0 && iterator.hasNext()) {
String host = iterator.next();
containerAllocateData.addHosts(host, 1);
countNeeded--;
}
}
if (log.isDebugEnabled()) {