void scheduleHeronWorkers(Set<ContainerPlan> containers) throws ContainerAllocationException {
    for (ContainerPlan containerPlan : containers) {
      int id = containerPlan.getId();
      if (containerPlans.containsKey(containerPlan.getId())) {
        throw new ContainerAllocationException("Received duplicate allocation request for " + id);
      }
      Resource reqResource = containerPlan.getRequiredResource();
      containerPlans.put(id, containerPlan);
      requestContainerForWorker(id, new HeronWorker(id, reqResource));
    }
  }
void scheduleHeronWorkers ( Set < ContainerPlan > containers ) throws ContainerAllocationException { for ( ContainerPlan containerPlan : containers ) { int id = containerPlan . getId ( ) ; if ( containerPlans . containsKey ( containerPlan . getId ( ) ) ) { throw new ContainerAllocationException ( "Received duplicate allocation request for " + id ) ; } Resource reqResource = containerPlan . getRequiredResource ( ) ; containerPlans . put ( id , containerPlan ) ; requestContainerForWorker ( id , new HeronWorker ( id , reqResource ) ) ; } }
Container allocation is asynchronous. Requests all containers in the input set serially
to ensure allocated resources match the required resources.