• 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

How the container makes thread of a servlet

 
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi ranchers,

I belive there is only one instance of each servlet which the container instantiate and initilaize...
But how the container makes threads of this servlet instance ( accorind the to API, GenericServlet doesn't extends Thread class and doesn't implement Runnable interface and it's the same for its subclass HttpServlet).
Any clarifications will be welcome

Thanks in advance
 
tarik el berrak
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No body can help ?
 
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Tarik,

Good question. As far as creating the threads to handle the requests is concerned it is the job of the container and not the servlet. That is why you wont find either the Servlet or the GenericServlet extending Thread or implementing the Runnable. An example of a container is Tomcat. Tomcat is a multi-threaded servlet container meaning if a new request comes in, after creating the instance of the servlet tomcat would create a thread or use one of its threads in the pool and assign it the corresponding request. So the thread management logic of creating the threads and destroying them is present in the container.

I hope it gives you some idea.
 
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hope this helps you

https://coderanch.com/t/176094/java-Web-Component-SCWCD/certification/Doubts-Web-Container-concept
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic