if (!resourceIt.hasNext()) {
break;
}
final ExecutionVertex vertex = vertexIt.next();
final AllocatedResource originalResource = vertex.getAllocatedResource();
if (!replacementMap.containsKey(originalResource)) {
final AllocatedResource replacementResource = resourceIt.next();
replacementMap.put(originalResource, replacementResource);
}
}
}
// Now replace the instances
final Iterator<ExecutionVertex> vertexIt = this.groupMembers.iterator();
while (vertexIt.hasNext()) {
final ExecutionVertex vertex = vertexIt.next();
final AllocatedResource originalResource = vertex.getAllocatedResource();
final AllocatedResource replacementResource = replacementMap.get(originalResource);
if (replacementResource != null) {
vertex.setAllocatedResource(replacementResource);
} else {
availableResources.add(originalResource);
}