private int countTasksShouldPreempt() {
    int tasksToPreempt = 0;
    long now = ClusterManager.clock.getTime();
    for (PoolGroupSchedulable poolGroup : poolGroupManager.getPoolGroups()) {
      for (PoolSchedulable pool : poolGroup.getPools()) {
        if (pool.isStarving(now)) {
          tasksToPreempt +=
            Math.min(pool.getPending(), pool.getShare() - pool.getGranted());
        }
      }
    }
    return tasksToPreempt;
  }
private int countTasksShouldPreempt ( ) { int tasksToPreempt = 0 ; long now = ClusterManager . clock . getTime ( ) ; for ( PoolGroupSchedulable poolGroup : poolGroupManager . getPoolGroups ( ) ) { for ( PoolSchedulable pool : poolGroup . getPools ( ) ) { if ( pool . isStarving ( now ) ) { tasksToPreempt += Math . min ( pool . getPending ( ) , pool . getShare ( ) - pool . getGranted ( ) ) ; } } } return tasksToPreempt ; }
Count how many tasks should preempt for the starving pools
@return The number of tasks should kill