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参数详解的更多相关文章

  1. Java 并发编程 | 线程池详解

    原文: https://chenmingyu.top/concurrent-threadpool/ 线程池 线程池用来处理异步任务或者并发执行的任务 优点: 重复利用已创建的线程,减少创建和销毁线程造 ...

  2. 并发编程——IO模型详解

    ​ 我是一个Python技术小白,对于我而言,多任务处理一般就借助于多进程以及多线程的方式,在多任务处理中如果涉及到IO操作,则会接触到同步.异步.阻塞.非阻塞等相关概念,当然也是并发编程的基础. ​ ...

  3. Android并发编程之白话文详解Future,FutureTask和Callable

    从最简单的说起Thread和Runnable 说到并发编程,就一定是多个线程并发执行任务.那么并发编程的基础是什么呢?没错那就是Thread了.一个Thread可以执行一个Runnable类型的对象. ...

  4. 从缓存入门到并发编程三要素详解 Java中 volatile 、final 等关键字解析案例

    引入高速缓存概念 在计算机在执行程序时,以指令为单位来执行,每条指令都是在CPU中执行的,而执行指令过程中,势必涉及到数据的读取和写入. 由于程序运行过程中的临时数据是存放在主存(物理内存)当中的,这 ...

  5. ThreadPoolExecutor参数详解

    ThreadPoolExecutor全部参数的构造函数 public ThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long ke ...

  6. 并发编程 || Java线程详解

    通用线程模型 在很多研发当中,实际应用是基于一个理论再进行优化的.所以,在了解JVM规范中的Java线程的生命周期之前,我们可以先了解通用的线程生命周期,这有助于我们后续对JVM线程生命周期的理解. ...

  7. java 并发编程lock使用详解

    浅谈Synchronized: synchronized是Java的一个关键字,也就是Java语言内置的特性,如果一个代码块被synchronized修饰了,当一个线程获取了对应的锁,执行代码块时,其 ...

  8. shell编程系列23--shell操作数据库实战之mysql命令参数详解

    shell编程系列23--shell操作数据库实战之mysql命令参数详解 mysql命令参数详解 -u 用户名 -p 用户密码 -h 服务器ip地址 -D 连接的数据库 -N 不输出列信息 -B 使 ...

  9. Java网络编程和NIO详解开篇:Java网络编程基础

    Java网络编程和NIO详解开篇:Java网络编程基础 计算机网络编程基础 转自:https://mp.weixin.qq.com/s/XXMz5uAFSsPdg38bth2jAA 我们是幸运的,因为 ...

随机推荐

  1. [Codeforces]852A - Digits

    题目大意:给一个10^200000以内的数字,支持一种操作:在数字之间加若干个加号,把原数字变为加法运算后的结果,要求在三次操作内把数字变成个位数,输出方案. 做法:直观的想法是每两位之间都塞加号,事 ...

  2. bzoj 2436: [Noi2011]Noi嘉年华

    Description NOI2011 在吉林大学开始啦!为了迎接来自全国各地最优秀的信息学选手,吉林大学决定举办两场盛大的 NOI 嘉年华活动,分在两个不同的地点举办.每个嘉年华可能包含很多个活动, ...

  3. 计蒜客NOIP2017提高组模拟赛(三)day2-直线的交点

    传送门 简单几何+逆序对 发现当两条直线甲乙与平板的交点在上面甲在较左的位置,那么下面甲在较右的位置就可以相交 然后把上面的位置排下序,下面离散化+树状数组即可 #include<cstdio& ...

  4. 【HDU 2669】Romantic

    Problem Description The Sky is Sprite.The Birds is Fly in the Sky.The Wind is Wonderful.Blew Throw t ...

  5. HEOI2017游记

    Day -1: noip与标准时限差了0.02秒,并没有申诉成功,导致NOIWC多交了900元钱. 滚回去准备学考,文科瞎写居然拿了A,可啪. NOIWC颓废记由于我实在太颓了所以懒得填坑了. THU ...

  6. Mysql安装的详细教程

    首先,针对本人最近几天各种电脑安装数据库失败,反思总结所有的方式.现写出详细教程,希望别的人少走弯路. 首先 这次内容分为如下几步 : 1.mysql之前安装的彻底清除 2.mysql版本的选取 3. ...

  7. VMware下安装Linux(CentOs6.3)操作系统

    VMware 10.0.2 CentOs 6.3 VMware的安装以及CentOs的下载比较简单,这里不再描述 1.创建新的虚拟机 2.选择典型 3.选择稍后安装操作系统 4.选择如图所示 5.虚拟 ...

  8. Python中byte与str

    原文传送门:请点击 现在计算机中,在内存中采用unicode编码方式. 可以看到上图中,字节型数据t并没有像想象中的一样显示0,1字符串.显示仍然是b,这是因为t是采用utf-8来编码,而utf-8与 ...

  9. TeamViewer 服务队列网页怎么打开?有什么用?

    熟悉一款软件,除了要熟悉它的界面,还应该熟悉它的网站.可能会有很多人说,网站我当然知道了.但是TeamViewer的服务队列页面你真的熟悉吗?所以,今天小编就带大家深入的了解一下TeamViewer服 ...

  10. python基础(1)

    1.python中三元表达式 类比于C.C++.Java中都有的三目运算符,python中使用下面语句实现三元表达式 true_part if condition else false_part. c ...