七个参数
Demo:
public class ExecutorDemo {
public static void main(String[] args) {
ExecutorService executorService = new ThreadPoolExecutor(3, 5, 1l, TimeUnit.SECONDS, new LinkedBlockingDeque<>(8), Executors.defaultThreadFactory(), new ThreadPoolExecutor.DiscardPolicy());
try{
for (int i = 0; i < 11; i++) {
final int a = i;
executorService.execute(()->{
System.out.println(Thread.currentThread().getName() + "\t 执行任务 "+a);
try {
TimeUnit.SECONDS.sleep(1);
} catch (InterruptedException e) {