aspose file tools*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes How the container makes thread of a servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "How the container makes thread of a servlet" Watch "How the container makes thread of a servlet" New topic
Author

How the container makes thread of a servlet

tarik el berrak
Greenhorn

Joined: Oct 06, 2006
Posts: 29
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


SCJP 1.5<br />New Target (SCWCD 5)
tarik el berrak
Greenhorn

Joined: Oct 06, 2006
Posts: 29
No body can help ?
Phani Burra
Ranch Hand

Joined: Dec 13, 2007
Posts: 52
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.
kalle suresh
Ranch Hand

Joined: Nov 20, 2007
Posts: 48
Hope this helps you

http://www.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.
 
subject: How the container makes thread of a servlet