code: private static void distributeSharePriority(
        double total, final Collection<? extends Schedulable> schedulables) {
  
      // 1) If share < sum(min(demand, min_alloc)) then do fair share and quit.
      double residualShare = assignShareIfUnderAllocated(total, schedulables);
      if (residualShare <= 0.0) {
        return;
      }
  
      // 2) Group schedulables according to priorities.
      TreeMap<Integer, Vector<Schedulable>> prioritizedSchedulableMap =
          generatePriorityGroupedSchedulables(schedulables);
  
      // 3) Trickle the share across priority groups.
      trickleShareDownPriorityGroups(residualShare, prioritizedSchedulableMap);
    }
docs: Distribute the total share among the list of schedulables according to the
  PRIORITY model. Note that the eventual intent is to determine if
  preemption is necessary. So, we need to assign the most ideal share on
  each schedulable beyond which preemption is necessary.
  Finds a way to distribute the share in such a way that all the
  min and max reservations of the schedulables are satisfied. In
  the PRIORITY scheduling, MINs are always granted to all pools. Therefore,
  irrespective of the demand of a pool, its share according to the
  algorithm will be at least MIN.
  
  @param total the share to be distributed
  @param schedulables the list of schedulables