zzh

zzh

Analysis of Executors.newCachedThreadPool

Basic Components#

image
The above figure shows that newCachedThreadPool is composed of 0 core threads + Integer.MAX_VALUE maximum threads + SynchronousQueue blocking queue (where each thread has a maximum survival time of 60s).

Execution Process#

image
For the SynchronousQueue blocking queue, since this blocking queue can only offer when taking an object, the red box part will return false and cannot enter. At this point, the green box part will be executed (a regular thread will be started and the corresponding command will be executed using the regular thread).

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.