The problem of CallerRunsPolicy discard Strategy in Java Thread Pool ThreadPoolExecutor

CallerRunsPolicy discard policy in Java thread pool ThreadPoolExecutor means that the thread that starts the thread pool runs extra threads. What if the thread that starts the thread pool is running some extra thread and there is a bunch of extra threads behind it?

Jan.12,2022

to put it simply, the thread behind the queue is waiting there.

rejected tasks run in the main thread, so the main thread is blocked, and other tasks continue to be submitted to the thread pool for execution only after the rejected task has been executed.

you can refer to this https://www.jianshu.com/p/9fe.

.
Menu