private int getQuotaForThisPriority(int totalQuota, int blocksForThisPriority,
      int blocksForLowerPriorities) {
    // reserve at most 20% for lower priority blocks
    int quotaForLowerPriorities = 
                     Math.min(totalQuota/5, blocksForLowerPriorities);
    return Math.min( blocksForThisPriority,
                     totalQuota-quotaForLowerPriorities);
  }
private int getQuotaForThisPriority ( int totalQuota , int blocksForThisPriority , int blocksForLowerPriorities ) { int quotaForLowerPriorities = Math . min ( totalQuota / 5 , blocksForLowerPriorities ) ; return Math . min ( blocksForThisPriority , totalQuota - quotaForLowerPriorities ) ; }
Decide the number of blocks to replicate on for this priority.
The heuristic is that allocate at most 20% the quota for
lower priority blocks

@param totalQuota max number of blocks can be replicated
@param blocksForThisPriority
number of needed replication blocks for this priority
@param blocksForLowerPriorities
number of lower priority needed replication blocks
@return the number blocks