Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

container managed Thread pool

 
S Majumder
Ranch Hand
Posts: 349
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everybody ,

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


regards,
S
 
Abhay Agarwal
Ranch Hand
Posts: 1376
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 349
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Abhay Agarwal for your reply .

How Developers create those threads on the fly ?

regards,
S
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic