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使用简介的更多相关文章

  1. java线程池ThreadPoolExecutor使用简介

    一.简介线程池类为 java.util.concurrent.ThreadPoolExecutor,常用构造方法为:ThreadPoolExecutor(int corePoolSize, int m ...

  2. 线程池ThreadPoolExecutor使用简介

    一.简介 线程池类为 java.util.concurrent.ThreadPoolExecutor,常用构造方法为: ThreadPoolExecutor(int corePoolSize, int ...

  3. 线程池ThreadPoolExecutor使用简介(转)

    一.简介 线程池类为 java.util.concurrent.ThreadPoolExecutor,常用构造方法为: ThreadPoolExecutor(int corePoolSize, int ...

  4. [转载]线程池ThreadPoolExecutor使用简介

    一.简介 线程池类为 java.util.concurrent.ThreadPoolExecutor,常用构造方法为: ThreadPoolExecutor(int corePoolSize, int ...

  5. 关于线程池ThreadPoolExecutor使用总结

    本文引用自: http://blog.chinaunix.net/uid-20577907-id-3519578.html 一.简介 线程池类为 java.util.concurrent.Thread ...

  6. 多线程学习笔记八之线程池ThreadPoolExecutor实现分析

    目录 简介 继承结构 实现分析 ThreadPoolExecutor类属性 线程池状态 构造方法 execute(Runnable command) addWorker(Runnable firstT ...

  7. 线程池ThreadPoolExecutor使用

    一.简介 线程池类为 java.util.concurrent.ThreadPoolExecutor,常用构造方法为: ThreadPoolExecutor(int corePoolSize, int ...

  8. 线程池ThreadPoolExecutor

    线程池类为 java.util.concurrent.ThreadPoolExecutor,常用构造方法为: ThreadPoolExecutor(int corePoolSize, int maxi ...

  9. [转] 引用 Java自带的线程池ThreadPoolExecutor详细介绍说明和实例应用

    PS: Spring ThreadPoolTaskExecutor vs Java Executorservice cachedthreadpool 引用 [轰隆隆] 的 Java自带的线程池Thre ...

随机推荐

  1. 006-PHP检测是否为整数

    <?php function checkInteger($Number) { if ($Number > 1) { /* 整数减1仍然是整数 */ return (checkInteger ...

  2. MyBatis笔记(一)

    MyBatis学习随笔 第一个MyBatis项目 创建项目 导入maven依赖,根据需要选择性添加mysql/oracle,spring,spring-mybatis等依赖,这里就不一一列出了 < ...

  3. C# MQTT M2MQTT

    MQTT 入门介绍 MQTT是基于二进制消息的发布/订阅编程模式的消息协议 实现MQTT协议需要客户端和服务器端通讯完成,在通讯过程中,MQTT协议中有三种身份:发布者(Publish).代理(Bro ...

  4. java基础源码 (6)--ArrayListt类

    原作出处:https://www.cnblogs.com/leesf456/p/5308358.html 简介: 1.ArrayList是一个数组队列,相当于动态数组.与java中的数组相比,它的容量 ...

  5. 2020/2/22 74cms3.5.1 代码审计

    0x00 网站结构 简单试了一下.每一个模块还是比较清楚的,分别对应网站的一个模块.还有一些没有权限访问 0x01 通读代码 先看入口文件,index.php 开头先对网站是否安装做了判断 然后就是判 ...

  6. 【LeetCode】101. 对称二叉树

    题目 给定一个二叉树,检查它是否是镜像对称的. 例如,二叉树 [1,2,2,3,4,4,3] 是对称的. 1 / \ 2 2 / \ / \ 3 4 4 3 但是下面这个 [1,2,2,null,3, ...

  7. UVA - 10635 Prince and Princess(LCS,可转化为LIS)

    题意:有两个长度分别为p+1和q+1的序列,每个序列中的各个元素互不相同,且都是1~n2的整数.两个序列的第一个元素均为1.求出A和B的最长公共子序列长度. 分析: A = {1,7,5,4,8,3, ...

  8. POJ 3692:Kindergarten 求补图的最大点独立集 头一次接触这样的做法

    Kindergarten Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 5884   Accepted: 2877 Desc ...

  9. 动手实验01-----vCenter 微软AD认证配置与用户授权

    环境说明: AD域->   centaline.net 阅读目录: 1. 配置与AD认证源 2.权限角色 1. 配置与AD认证源 登陆vCenter后,在 系统管理 -> 配置 -> ...

  10. 复选框全选、反选及根据值JS控制复选框默认选中事件

    HTML代码 <div class="col-sm-7"> <input type="checkbox" id="allAndNot ...