池ThreadPoolExecutor使用简介
public static void main(String[] args) {
//guava 创建线程池
//https://blog.csdn.net/chinabestchina/article/details/89527931
ExecutorService executorService = new ThreadPoolExecutor(2,5,30,TimeUnit.SECONDS,
new LinkedBlockingDeque<>(),new ThreadFactoryBuilder().setNameFormat("cs-m-%d").build(),new ThreadPoolExecutor.DiscardOldestPolicy()); ListeningExecutorService listeningExecutorService = MoreExecutors.listeningDecorator(executorService);
listeningExecutorService.submit(()-> System.out.println(Thread.currentThread().getName()+ "===1"));
listeningExecutorService.submit(()-> System.out.println(Thread.currentThread().getName()+ "===2"));
listeningExecutorService.submit(()-> System.out.println(Thread.currentThread().getName()+ "===3")); listeningExecutorService.shutdown(); }
https://blog.csdn.net/chinabestchina/article/details/89527931#41_MoreExecutors_53https://www.cnblogs.com/yszzu/p/10122658.html
https://coach.iteye.com/blog/855850
https://www.twle.cn/c/yufei/javatm/javatm-basic-google-guava.html
池ThreadPoolExecutor使用简介的更多相关文章
- java线程池ThreadPoolExecutor使用简介
一.简介线程池类为 java.util.concurrent.ThreadPoolExecutor,常用构造方法为:ThreadPoolExecutor(int corePoolSize, int m ...
- 线程池ThreadPoolExecutor使用简介
一.简介 线程池类为 java.util.concurrent.ThreadPoolExecutor,常用构造方法为: ThreadPoolExecutor(int corePoolSize, int ...
- 线程池ThreadPoolExecutor使用简介(转)
一.简介 线程池类为 java.util.concurrent.ThreadPoolExecutor,常用构造方法为: ThreadPoolExecutor(int corePoolSize, int ...
- [转载]线程池ThreadPoolExecutor使用简介
一.简介 线程池类为 java.util.concurrent.ThreadPoolExecutor,常用构造方法为: ThreadPoolExecutor(int corePoolSize, int ...
- 关于线程池ThreadPoolExecutor使用总结
本文引用自: http://blog.chinaunix.net/uid-20577907-id-3519578.html 一.简介 线程池类为 java.util.concurrent.Thread ...
- 多线程学习笔记八之线程池ThreadPoolExecutor实现分析
目录 简介 继承结构 实现分析 ThreadPoolExecutor类属性 线程池状态 构造方法 execute(Runnable command) addWorker(Runnable firstT ...
- 线程池ThreadPoolExecutor使用
一.简介 线程池类为 java.util.concurrent.ThreadPoolExecutor,常用构造方法为: ThreadPoolExecutor(int corePoolSize, int ...
- 线程池ThreadPoolExecutor
线程池类为 java.util.concurrent.ThreadPoolExecutor,常用构造方法为: ThreadPoolExecutor(int corePoolSize, int maxi ...
- [转] 引用 Java自带的线程池ThreadPoolExecutor详细介绍说明和实例应用
PS: Spring ThreadPoolTaskExecutor vs Java Executorservice cachedthreadpool 引用 [轰隆隆] 的 Java自带的线程池Thre ...
随机推荐
- UCENTER同步登录工作原理和配置要点
ucenter的同步登录原理: 1)Ucenter是和uc_client同步的.每个PHP应用,加入了UCENTER后,都会在主目录下有个UC_CLIENT目录.这个目录里,都有一个client.PH ...
- java 如何爬取百度百科词条内容(java如何使用webmagic爬取百度词条)
这是老师所布置的作业 说一下我这里的爬去并非能把百度词条上的内容一字不漏的取下来(而是它分享链接的一个主要内容概括...)(他的主要内容我爬不到 也不想去研究大家有好办法可以call me) 例如 互 ...
- asp.net增加指定404页面
对于在asp中添加404页面我并不熟悉,所以刚开始只能在网上找各种资料,网上资源太多,各种借鉴. 1.借鉴网上尝试的第一种方法: 首先,修改应用程序根目录的设置,打开 “web.config” ...
- Struts+Hibernate+Spring面试题合集及答案(转)
Struts+Hibernate+Spring面试题合集及答案 Struts+Hibernate+Spring 面试题合集 1 1. Hibernate部分 2 1.1. Hibernate工作原理 ...
- JPA#OneToOne
无力吐槽. 一对一,一个人有一个身份证号码.一个人有一条命,类似于这一种的就是一对一的关系. 涉及到的注解两个: OneToOne JoinColumn( name="当前实体对应数据库表中 ...
- 14.swoole学习笔记--异步读取文件
<?php //异步读取文件 swoole_async_readfile(__DIR__."/1.txt",function($filename,$content){ ech ...
- eclipse 项目启动不了问题
有可能是因为dubugger 打多了,所有启动不起来 解决方案:window——show view ——other....——breakpoints去除所有断点
- 经验分享:如何搞定Personal Statement?
最近又到申请季啦,如何自己DIY申请,如何准备文书成为众多留学生关心的问题.不管是你申请本科,硕士,还是博士,相信这篇文章都能帮助到你.下面来说一下文书中一个很重要的组成,就是个人陈述Personal ...
- 报错SQL盲注之BIGINT 溢出
首先感谢原创博主,在此致敬.本文转自:http://www.cnblogs.com/lcamry/articles/5509112.html MySQL版本在 5.5.5 及其以上 0x01 概述 我 ...
- 框架基础学习之--详解web+maven+spring+mybatis+struts框架文件夹作用
详解web+maven+spring+mybatis+struts框架文件夹作用 1.程序名 2.Mybatis,mybatis是数据持久层,就是和对象类有关系的东西 3.存放java文件,xml,p ...