Java Thread pool
Java Thread pool is a collection of worker threads that are waiting for the tasks and can be reused many times.
Instead of starting a new thread for every time for each task to execute concurrently, the task can be passed to a existing thread pool. As soon as the pool has find any idle threads then that task can be assigned to one of them and will be executed.
BlockingQueue is used to implement the thread pool, when a new task is inserted into the queue one of the idle threads will dequeue it successfully and execute it. The rest of the idle threads in the pool will be blocked and waiting to dequeue tasks.
Real time usage
Servlets and JSPs are the real time usage of thread pool where container creates a pool of threads to process the incoming request.
Java have built in thread pools in java.util.concurrent package, so there is no need to implement your own thread pool. ExecutorService and Executors interfaces provides many in-built thread pools in java.
ThreadPool is very important in java because it saves time as there is no need to create new thread.