* Moves visitor pattern to java 11 * Moves value-object pattern to java 11 * Moves unit-of-work pattern to java 11 * Moves typeobjectpattern pattern to java 11 * Moves twin pattern to java 11 * Moves trampoline pattern to java 11 * Moves tolerant-reader pattern to java 11 * Moves tls pattern to java 11 * Moves throttling pattern to java 11 * Moves thread-pool pattern to java 11 * Moves template-method pattern to java 11
layout, title, folder, permalink, categories, tags
layout | title | folder | permalink | categories | tags | |||
---|---|---|---|---|---|---|---|---|
pattern | Thread Pool | thread-pool | /patterns/thread-pool/ | Concurrency |
|
Intent
It is often the case that tasks to be executed are short-lived and the number of tasks is large. Creating a new thread for each task would make the system spend more time creating and destroying the threads than executing the actual tasks. Thread Pool solves this problem by reusing existing threads and eliminating the latency of creating new threads.
Applicability
Use the Thread Pool pattern when
- you have a large number of short-lived tasks to be executed in parallel