This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Servlets and the fly likes container managed Thread pool Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "container managed Thread pool" Watch "container managed Thread pool" New topic
Author

container managed Thread pool

S Majumder
Ranch Hand

Joined: Jun 03, 2009
Posts: 244
Hi everybody ,

What is container managed Thread pool and how actually it is working ?


regards,
S
Abhay Agarwal
Ranch Hand

Joined: Feb 29, 2008
Posts: 1076
    
    1

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

~ abhay
S Majumder
Ranch Hand

Joined: Jun 03, 2009
Posts: 244
Thanks Abhay Agarwal for your reply .

How Developers create those threads on the fly ?

regards,
S
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: container managed Thread pool
 
Similar Threads
How are Servlets and objects in it instantiated?
A question about 'single-threaded mode'
Container Managed Thread Pool
Application vs Container Managed Connection Pool
Servlet Thread Killing.