池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 ...
随机推荐
- delphi关闭和禁用Windows服务
function StopServices(const SvrName: string): Boolean; var SCH, SvcSCH: SC_HANDLE; SS: TServiceStatu ...
- android studio (安卓开发)如何使用外部模拟器(mumu模拟器)调试运行程序
开发安卓 我觉得大家明白自带的模拟器卡的要死而且启动慢(我觉得八核的计算机应该可以解决这个问题),这里使androidstudio 使用外部模拟器 MuMu模拟器 配置方法 eclipse 开发安卓 ...
- Window Server 2019 配置篇(2)- 在window server core上安装网络跟DHCP服务
上一篇我们已经建立了自己的域服务器 之后我们将安装一个window server core,也就是没有GUI只有命令行的window server,并在其上安装网络服务和DHCP 首先创建一个新的虚拟 ...
- Golang的环境安装
Golang的环境安装 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.Go语言环境安装 1>.下载Golang的安装包 博主推荐阅读: https://studygola ...
- Android之UI适配
LinearLayout为线性布局按照垂直或者水平来进行排列,默认是按照水平来进行排列的,其中orientation属性是指定当前布局排列的方向 wrap_content为包裹内容 match_p ...
- JS - 获取任意一天的0点和23:59:59时间
转载自 https://www.cnblogs.com/sk-3/archive/2019/07/23/11232750.html 使用了setHours() 方法 setHours() 方法用于设置 ...
- 七十九、SAP中数据库操作之更新数据,UPDATE的用法
一.我们查看SFLIGHT数据库,比如我们需要改这条数据 二.代码如下 三.执行效果如下,显示“数据更新成功” 四.我们来看一下SFLIGHT数据库,发现已经由DEM更改为了AAA了
- 073-PHP数组元素相加
<?php $arr1=array(1,2,3,4,'5','05',TRUE); //等价于 1+2+3+4+5+5+1=21 $arr2=array(1,2,'ABC',3,'hello', ...
- 了解facade设计模式
Facade模式 Facade模式要求一个子系统的外部与其内部的通信必须通过一个统一的Facade对象进行.Facade模式提供一个高层次的接口,使得子系统更易于使用. 就如同医院的接待员一样,Fac ...
- 压测工具siege和wrk
siege压测工具 安装: wget http://download.joedog.org/siege/siege-3.0.8.tar.gz cd siege-3.0.8 ./configure ma ...