Servlets are multi threaded by default. If there are concurrent requests to the same servlet the servlet container generates another instance of the servlet . Is this the reason y servelts are multi threaded by default?? Is there any way the multi threaded feature can be achieved ?

Questions by aneesm   answers by aneesm

Showing Answers 1 - 12 of 12 Answers

Vignesh

  • Nov 19th, 2007
 


I dont think  muti threading is  impliying in Servlet Container. Servlet is based on the client request. Virtually like muti thread and servlet acting same. but the context passing with Servlet is entirly different.

  Was this answer useful?  Yes

bhaskarrao

  • Dec 2nd, 2007
 

If there are concurrent requests to the same servlet, the servlet container creates a new thread. It does'nt create another instance.
It creates a new instance if any servlet alias is there or if instance pooling option is there.

  Was this answer useful?  Yes

AjayMukiri

  • Apr 29th, 2008
 

Servlets are multi threaded by default. If there are concurrent requests to the same servlet the servlet container generates New Thread . So this the reason servelts are multi threaded by default.

one thing surely i can say and that is "only one insatnce of the servelet would be created" and multiple threads would be used to serve the request.......
well if the requests are very large in number then the container might kill/suspend some  threads and that would be dependent on the servlet container you are using..... but not more than once instance per servlet

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions