Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Threads

 
Gunnar Maluf
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all

I know threads from the scjp exam where the code in the run() method runs in a different memory stack. But i am not sure about threads in servlets. I know the container creates one object/instance per servlet but i dont know what would be in the run() method. The whole class?

regards
Gunnar
 
Amit M Tank
Ranch Hand
Posts: 257
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thats upto the container to implement. generally the container have a threadPool (pool of Thread). Whenever a request comes a new Thread is taken from the Thread pool and is associated with the request by the container. In short the run method would somehow call the service method of the servlet(directly or indirectly through layer of abstraction).
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!