public final class ThreadExecutor {

    private static final Integer CORE_POOL_SIZE = 20;
    private static final Integer MAX_POOL_SIZE = 30;
    private static final Integer KEEP_ALIVE_TIME = 60;
    private static final Integer QUEUE_SIZE = 1000;
    public static final ExecutorService EXECUTOR_SERVICE;

    static {
        EXECUTOR_SERVICE = new ThreadPoolExecutor(CORE_POOL_SIZE, MAX_POOL_SIZE, (long) KEEP_ALIVE_TIME, TimeUnit.MINUTES, new ArrayBlockingQueue(QUEUE_SIZE));
    }
}

使用:

ThreadExecutor.EXECUTOR_SERVICE.submit(); //入参是一个实现了Runnable接口的线程类