Collections.sort(affinedEPs);
Iterator<EndpointAffinity> affinedEPItr = Iterators.cycle(Lists.reverse(affinedEPs));
/** Maximum number of slots which should go to endpoints with affinity */
int affinedSlots = Math.min((Math.max(1, (int) (affinityFactor*width/allEndpoints.size())) * affinedEPs.size()), width);
while(endpoints.size() < affinedSlots) {
EndpointAffinity ea = affinedEPItr.next();
DrillbitEndpoint endpoint = ea.getEndpoint();
endpoints.add(endpoint);
}
}
// add other endpoints if required
if (endpoints.size() < width) {