1.创建10个线程的线程池
ExecutorService service = Executors.ThreadPoolExecutor(10)
2.无返回值执行线程(lambda写法)
service.execute(()->{
SysTem.out,println(Thread.currentThread.getName());
});
3.关闭线程池
service.shutdown();
1.创建10个线程的线程池
ExecutorService service = Executors.ThreadPoolExecutor(10)
2.无返回值执行线程(lambda写法)
service.execute(()->{
SysTem.out,println(Thread.currentThread.getName());
});
3.关闭线程池
service.shutdown();