When to use the cached thread pool?

TLDR: Use the cached thread pool where no significant load is expected or in tests. Do not use the cached thread pool in highly loaded applications and where you do not have any control over the number of tasks that can get into the thread pool.

Motivation.

If there’s no threads which are ready to handle a task, a new thread will be created. If the number of tasks is more than a server can serve, the number of the threads will grow and the situation will be even worst.

Links.

  • Effective java (Item 80).

--

--