• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Is it the container or the Thread??

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Kathy and Bryan mention in their book HFS&J that the service() method in servlets is called by the container.How is it done?I believed that the container just created a thread and "started" it and then it was the run() method of the thread that had a call to service() which in turn would call doXXX().
 
author
Posts: 199
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Mayank,

You answered your own question. The container is all of the code that makes up what you just described (plus a lot lot more).

-Bryan
 
Ranch Hand
Posts: 3271
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I believe you're dead on, Mayank. However, I believe some containers will utilize a thread pool, rather than always creating a new thread. So, it may be possible that the container will reuse a thread, rather than making a new one for each request. Regardless, the thread assigned to the request is responsible for invoking the service() method of the HttpServlet.
 
Ranch Hand
Posts: 4982
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Whether there is a pool for Servlet instances, and how many instances a container kept is vendor specific.

But at least, IBM WAS does provide a Servlet pool for holding several instances to serve simultaneous requests. I do believe this will the majority of the well-known containers.

Nick
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic