Hello people, I had a query regarding Servlets. We know that niether Servlet,GenericServlet or HttpServlet implements Runnable interface .My question is first ,how could a container create threads of the servlet when its not Runnable, and secondly which part of the servlet is run .
Joined: Mar 22, 2005
"abhijit.r", it's time for you to finally adjust your display name to something valid. You've been asked to do this several times, now you're very close to getting your account closed. You should do this before your next post.
As to your question, it's simple: the container creates a new thread, and from within that thread it calls the service method of the servlet.
Joined: Aug 07, 2008
I still dont get it .This thread that the container creates is it a java thread,(one in which you call start and run executes)or some other kind of thread.If its a java thread then how can the servlet class have a thread when it doesnt implement Runnable .Lastly what is executed in the new thread only service methods of servlet .
Joined: Oct 20, 2007
Exactly I had the same question and answered well. Probably you may want to refer this