This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
First let us understand
what is Thread pool Thread pool is concept where in a pre-defined number of threads can be created/initialized in advance (for example, during server start up) and stored in virtual memory. Threads are created in advance because this reduces the amount of resources required to create new threads at run time. So, Thread pool eliminate the need to create new threads at runtime. Advantage of Thread pool is that it allows components of application server to reuse threads.
Now we come to 'Container managed'.
For any web application, Thread pool concept can be implemented either by Web Application Developers OR it can be implemented by 'Application Server(container)' that we are using to host our web application. So, for any webapplication, if conatiner manages thread pool for us, then, we are said to be using 'container managed thread pool'.
How container manages Thread pool ? The container has a thread pool and a request queue. When a request comes in, it's added to the queue. A listener takes the request off the queue, checks a thread out of the thread pool, and gives it the request to process. When the process is complete, the thread goes back into the pool to await its next assignment.When the thread pool is exhausted (all thread are busy in catering other requests), requests back up in the queue until sufficient resources are available to process them.
Hope this explanation helps you in basics of container managed thread pool