Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Thread Management by Container

 
MaheshS Kumbhar
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
MaheshS Kumbhar
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can I know on this?
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13061
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 201
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
...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
Posts: 580
Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic