package com.zhangxueliang.demo.springbootdemo.JUC.c_026_01_ThreadPool;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
/**
* @ProjectName springbootdemo_src
* @ClassName T05_ThreadPool
* @Desicription TODO
* @Author Zhang Xueliang
* @Date 2019/12/5 15:58
* @Version 1.0
**/
public class T05_ThreadPool {
public static void main(String[] args) {
ExecutorService executorService = Executors.newFixedThreadPool(5);
for (int i = 0; i < 6; i++) {
executorService.execute(()->{
System.err.println(Thread.currentThread().getName()+" aaaaa");
});
}
System.err.println(executorService);
executorService.shutdown();
}
}
Executors.newFixedThreadPool()使用示例
原创a772304419 ©著作权
©著作权归作者所有:来自51CTO博客作者a772304419的原创作品,请联系作者获取转载授权,否则将追究法律责任

提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章