当前位置:网站首页>0722~ thread pool extension

0722~ thread pool extension

2022-07-23 13:21:00 Life is so hard

Seven parameters of thread ( a key ):

1. Number of core threads ;

2. Maximum number of threads ;

3. Survival time ;

4. Unit of time to live ;

5. Set thread queue ;

6. Set the thread factory ;

7. Set rejection policy ;

Four common thread pools :

Cache thread pool ( The fastest ):newCachedThreadPool;

Single thread pool ( The slowest ):newSingleThreadExecutor;

Fixed thread pool ( Xiaokuai ):newFixedThreadPool;

These three thread pools are generally not used in projects , All use custom thread pools ;

 

  pluses : Submission priority and execution priority ;

  Submit priority : The core --> queue --> Non core

  Execution priority : The core --> Non core --> queue

原网站

版权声明
本文为[Life is so hard]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/204/202207230606444760.html