Here you can find the source of getExecutor(int numTasks, int maxThreads)
public static ExecutorService getExecutor(int numTasks, int maxThreads)
//package com.java2s; //License from project: Apache License import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; public class Main { public static ExecutorService getExecutor(int numTasks, int maxThreads) { if (numTasks <= maxThreads) { return Executors.newFixedThreadPool(numTasks); } else {// w ww. j a va 2 s . com return Executors.newFixedThreadPool(maxThreads); } } }