File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes Thread Management by Container Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Thread Management by Container" Watch "Thread Management by Container" New topic
Author

Thread Management by Container

MaheshS Kumbhar
Ranch Hand

Joined: Sep 24, 2009
Posts: 188
As per I read, Container creates or allocates thread to each new request. Following are my questions.
1. How does that thread gets access to our Servlet defined doGet/doPost method?
2.Is it that threads run() method calls Servlets service() method which in turn calls doGet or doPost method depending upon HTTP request type, so that each request is handled in separate call stack?


I am slow but sure
MaheshS Kumbhar
Ranch Hand

Joined: Sep 24, 2009
Posts: 188
Can I know on this?
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12803
    
    5
If you want to see exactly how it is done you could download the full source code for Tomcat or any other open source servlet container.

You could also search for "Java thread pool" and see various approaches to the general problem in detail.

Bill
Girish Vasmatkar
Ranch Hand

Joined: Apr 24, 2008
Posts: 201
...or just grab a copy of Head first servlets and JSP where you can find answers to all of your questions.

Best wishes !!
James Tharakan
Ranch Hand

Joined: Aug 29, 2008
Posts: 580

MaheshS Kumbhar wrote:
2.Is it that threads run() method calls Servlets service() method which in turn calls doGet or doPost method depending upon HTTP request type, so that each request is handled in separate call stack?


May be this thread will be of little help


SCJP 6
Why to worry about things in which we dont have control, Why to worry about things in which we have control ! !
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Thread Management by Container