...
Thread pools allow the system to service as many requests as it can comfortably sustain, instead of terminating all services when faced with a deluge of requests. They overcome these issues because the maximum number of worker threads that can be initiated and executed concurrently can be suitably controlled. Every worker accepts a Runnable
or Callable<T>
task and stores it in a temporary Channel
such as a buffer or a queue until resources become available. Because threads in a thread pool can be reused, and efficiently added and removed from the Channel
, there is minimal thread life-cycle management related overhead.
Noncompliant Code Example
...