public static BalancingThreadPoolExecutor newBalancingThreadPoolExecutor(int maxThreads,
                                                                             float targetUtilization,
                                                                             float smoothingWeight,
                                                                             int balanceAfter) {
        ThreadPoolExecutor tpe = new ThreadPoolExecutor(1, maxThreads, 60L, TimeUnit.SECONDS, new SynchronousQueue<Runnable>(), new CallerBlocksPolicy());
        return newBalancingThreadPoolExecutor(tpe, targetUtilization, smoothingWeight, balanceAfter);
    }
public static BalancingThreadPoolExecutor newBalancingThreadPoolExecutor ( int maxThreads , float targetUtilization , float smoothingWeight , int balanceAfter ) { ThreadPoolExecutor tpe = new ThreadPoolExecutor ( 1 , maxThreads , 60L , TimeUnit . SECONDS , new SynchronousQueue < Runnable > ( ) , new CallerBlocksPolicy ( ) ) ; return newBalancingThreadPoolExecutor ( tpe , targetUtilization , smoothingWeight , balanceAfter ) ; }
Return a capped {@link BalancingThreadPoolExecutor} with the given
maximum number of threads, target utilization, smoothing weight, and
balance after values.

@param maxThreads        maximum number of threads to use
@param targetUtilization a float between 0.0 and 1.0 representing the
percentage of the total CPU time to be used by
this pool
@param smoothingWeight   smooth out the averages of the CPU and wait time
over time such that tasks aren't too heavily
skewed with old or spiking data
@param balanceAfter      balance the thread pool after this many tasks
have run