当前位置:网站首页>[eight part essay] usage scenarios and features of JUC
[eight part essay] usage scenarios and features of JUC
2022-04-22 19:43:00 【Ch.yang】
Thread safety
Unified management thread
Thread pool



Start and stop thread pool
- perform
execute() - Non violent cessation
shutdown()—— No new assignments , Perform all tasks and stop , Set upisSutdown: true- Finally stop
isTerminated()
- Finally stop
- Check if it stops
awaitTermination(3, TImeUnit.SECONDS)—— wait for 3s, Check whether the thread stops - The violence stopped
shutdownNow()—— Stop the current task , Return the task blocking the queue .( It means a bit of service degradation )
4 Type of rejection policy

Own thread pool
It's all... In essence ThreadPoolExecutor
jdk Packaged FixedThreadPool
- Use unbounded queues , Based on the list ;—— Easy to produce OOM
jdk Packaged SingleThreadPool
- It's also an unbounded queue , ditto
jdk Packaged CacheThreadPool
- Queues do not store elements , Create thread pool directly
jdk Packaged ScheduleThreadPool
- Time related
jdk Packaged WorkStealingPool
- Cut the overall task into sub tasks ( recursive ), It can be executed in parallel
Create your own thread pool

Inherit ThreadPoolExecutor
Hook function

Coordination between threads
版权声明
本文为[Ch.yang]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204221935289641.html
边栏推荐
- .net socket. IO client usage
- Unable to log in to remote MySQL server 1045 error
- . net learning notes (III) -- ubiquitous features
- Revit (5) - second opening - creating walls
- MySql根据起始结束日期获取每一天的集合
- The available space of SQL server is too large. Recycle the unused space
- STM32 learning record 006 - new project template (based on firmware library)
- 家用智能投影仪首选,走进极米H3S投影
- .net 用supersocket搭建socket server
- [Niuke brush question 19] MP3 cursor position
猜你喜欢

2018-8-10-win10-uwp-商业游戏-1.2.1

12-Delta Lake

【AI视野·今日NLP 自然语言处理论文速览 第三十三期】Thu, 21 Apr 2022

Golang本地缓存选型对比及原理总结
![[Niuke brush question 19] MP3 cursor position](/img/ea/8ec110cbacf68ea0337437e311cc72.png)
[Niuke brush question 19] MP3 cursor position

Detailed explanation of redis deployment in Linux Environment

软件测试入行必看,一文800字教你Allure 测试报告环境搭建

家用智能投影仪首选,走进极米H3S投影

【AI视野·今日Robot 机器人论文速览 第三十三期】Thu, 21 Apr 2022

【八股文】线程安全问题
随机推荐
JS copy and paste, clipboard js
06. 重构-简化条件表达式
[AI vision · quick review of NLP natural language processing papers today, issue 33] Thu, 21 APR 2022
指针与对象的一些注意事项
中信证券怎么样?启牛学堂让开户,安全吗?
家用智能投影仪首选,走进极米H3S投影
Error when calling MySQL stored procedure: MySQL 1449: the user specified as a definer ('root '@'% ') does not exist
讲 透Object.prototype.toString.call()
MYSQL,组合的唯一索引中,处理NULL值的问题
LeetCode_ 343 integer split
Revit (5) - second opening - creating walls
Learning Android 7 from scratch -- sharing data across programs
C#16进制字符串转换IEEE754标准的十进制单精度浮点数
Influxdb根据time删除某条数据
.net 用supersocket搭建socket server
听不懂梗怎么办?谷歌5400亿参数新模型可以给你解释笑点,还能通过emoji表情猜电影
The SQL statement obtains each day, week, month and year according to the start and end date
添加/删除/筛选/排序数组元素
postman 测试 Array、List、Map 入参 API 正确姿势
uniapp商品分类选项卡