【并发编程】ThreadPoolExecutor参数详解
ThreadPoolExecutor executor = new ThreadPoolExecutor(
int corePoolSize,
int maximumPoolSize,
long keepAliveTime,
TimeUnit unit,
BlockingQueue<Runnable> workQueue);
Core pool size
The lower limit of threads that are contained in the thread pool. Actually, the thread
pool starts with zero threads, but once the core pool size is reached, the number of
threads does not fall below this lower limit. If a task is added to the queue when the
number of worker threads in the pool is lower than the core pool size, a new thread
will be created even if there are idle threads waiting for tasks. Once the number of
worker threads is equal to or higher than the core pool size, new worker threads
are only created if the queue is full—i.e., queuing gets precedence over thread cre‐
ation.
Maximum pool size
The maximum number of threads that can be executed concurrently. Tasks that are
added to the queue when the maximum pool size is reached will wait in the queue
until there is an idle thread available to process the task.
Maximum idle time (keep-alive time)
Idle threads are kept alive in the thread pool to be prepared for incoming tasks to
process, but if the alive time is set, the system can reclaim noncore pool threads.
The alive time is configured in TimeUnits , the unit the time is measured in.
Task queue type
An implementation of BlockingQueue that holds
tasks added by the consumer until they can be processed by a worker thread. De‐
pending on the requirements, the queuing policy can vary.
【并发编程】ThreadPoolExecutor参数详解的更多相关文章
- Java 并发编程 | 线程池详解
原文: https://chenmingyu.top/concurrent-threadpool/ 线程池 线程池用来处理异步任务或者并发执行的任务 优点: 重复利用已创建的线程,减少创建和销毁线程造 ...
- 并发编程——IO模型详解
我是一个Python技术小白,对于我而言,多任务处理一般就借助于多进程以及多线程的方式,在多任务处理中如果涉及到IO操作,则会接触到同步.异步.阻塞.非阻塞等相关概念,当然也是并发编程的基础. ...
- Android并发编程之白话文详解Future,FutureTask和Callable
从最简单的说起Thread和Runnable 说到并发编程,就一定是多个线程并发执行任务.那么并发编程的基础是什么呢?没错那就是Thread了.一个Thread可以执行一个Runnable类型的对象. ...
- 从缓存入门到并发编程三要素详解 Java中 volatile 、final 等关键字解析案例
引入高速缓存概念 在计算机在执行程序时,以指令为单位来执行,每条指令都是在CPU中执行的,而执行指令过程中,势必涉及到数据的读取和写入. 由于程序运行过程中的临时数据是存放在主存(物理内存)当中的,这 ...
- ThreadPoolExecutor参数详解
ThreadPoolExecutor全部参数的构造函数 public ThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long ke ...
- 并发编程 || Java线程详解
通用线程模型 在很多研发当中,实际应用是基于一个理论再进行优化的.所以,在了解JVM规范中的Java线程的生命周期之前,我们可以先了解通用的线程生命周期,这有助于我们后续对JVM线程生命周期的理解. ...
- java 并发编程lock使用详解
浅谈Synchronized: synchronized是Java的一个关键字,也就是Java语言内置的特性,如果一个代码块被synchronized修饰了,当一个线程获取了对应的锁,执行代码块时,其 ...
- shell编程系列23--shell操作数据库实战之mysql命令参数详解
shell编程系列23--shell操作数据库实战之mysql命令参数详解 mysql命令参数详解 -u 用户名 -p 用户密码 -h 服务器ip地址 -D 连接的数据库 -N 不输出列信息 -B 使 ...
- Java网络编程和NIO详解开篇:Java网络编程基础
Java网络编程和NIO详解开篇:Java网络编程基础 计算机网络编程基础 转自:https://mp.weixin.qq.com/s/XXMz5uAFSsPdg38bth2jAA 我们是幸运的,因为 ...
随机推荐
- [ZJOI2007]棋盘制作
题目描述 国际象棋是世界上最古老的博弈游戏之一,和中国的围棋.象棋以及日本的将棋同享盛名.据说国际象棋起源于易经的思想,棋盘是一个8*8大小的黑白相间的方阵,对应八八六十四卦,黑白对应阴阳. 而我们的 ...
- poj 1269 线段与线段相交
Intersecting Lines Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 13605 Accepted: 60 ...
- hdu3966 点权模板-树链部分
Aragorn's Story Time Limit: 10000/3000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) ...
- Linux LCD 显示图片【转】
转自:https://blog.csdn.net/niepangu/article/details/50528190 BMP和JPEG图形显示程序1) 在LCD上显示BMP或JPEG图片的主流程图首 ...
- jQuery ajax中使用serialize()方法提交表单数据示例
<form id="form"> 输入账号 :<input id="name" type="text" name=&quo ...
- js生成四位随机数的简便方法
do out = Math.floor(Math.random()*10000); while( out < 1000 ) alert( out );
- JS中数组和字符串的方法大全
数组的方法很多,ECMScript5又提供了好几种方法.有空把之前的云上的笔记整理了一下,方便自己以后查找使用. 一.ECMScript 3的Array.prototype中定义的方法 1.join( ...
- Nginx之(三)Nginx配置
一个简单的配置文件如下: #定义Nginx运行的用户及用户组 user userName userGroupName; #工作进程数目,根据硬件调整,通常等于CPU数量或者2倍于CPU worker_ ...
- Latex:入门教程
http://blog.csdn.net/pipisorry/article/details/54571521 总的来说,LaTex是一套排版系统,与word那种所见即所得对排版方式不太,用LaTex ...
- valgrind检测内存泄漏
Valgrind 使用 用法:valgrind [options] prog-and-args [options]: 常用选项,适用于所有Valgrind工具 -tool=<name>最常 ...