About thread pools

Core parameters of thread pool

The process of adding threads to the thread pool

By default, a thread is created for each new task until the number of threads in the thread pool reaches corepoolsize.

When the number of threads in the thread pool reaches corepoolsize, a new task will be added to the task cache queue.

If cache queue is full, thread pool will continue to create new threads to process newly submitted tasks.

The maximum number of threads allowed in the thread pool is maximumpoolsize. If this number is exceeded, the thread pool will process according to the rejection policy.

After the number of threads in the thread pool exceeds the corepoolsize, if the idle thread is idle for more than keepalivetime, it will be terminated.

If keepalivetime is allowed to be set for threads in the core pool, threads in the core pool will also be recycled after their idle time exceeds keepalivetime.

other

Threads of the core pool can also be pre created. The related methods are: prestartcorethread() and prestartallcorethreads().

Thread pool capacity can be dynamically adjusted.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>