Java thread pool ThreadPoolExecutor (below) --- thread timeout closes its own implementation

"Java thread pool working principle and commonly used WorkQueue" this article can refer to the specific writing

The thread timeout shutdown mechanism is implemented by the poll() method of BlockingQueue.
Insert picture description here
When the task of a thread is completed, the task in the cache will be fetched from the cache of the workQueue ------ poll(), if it exceeds the set time ------ Before the keepAliveTime has received the task, the queue returns null and the thread closes itself.

Guess you like

Origin blog.csdn.net/nikyae/article/details/111185352