Thread pool internal structure (composition)

The Java thread pool consists of 4 parts. The working principle of the thread pool is in the producer-consumer mode

(1) Thread Pool Manager (ThreadPool): is responsible for creating and destroying the thread pool
(2) Worker thread (PoolWorker): it is a thread in the thread pool
(3) Task (Task): this is the thread pool The business code that a thread needs to execute, this is the business logic you write yourself
(4) Task Queue (TaskQueue): This is the task thrown into the thread pool that needs to be queued and needs to be entered into the task queue

Insert picture description here

Guess you like

Origin blog.csdn.net/qq_41489540/article/details/114539857