The thread timeout shutdown mechanism is implemented by the poll() method of BlockingQueue.
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.
Java thread pool ThreadPoolExecutor (below) --- thread timeout closes its own implementation
Guess you like
Origin blog.csdn.net/nikyae/article/details/111185352
Ranking