How to make servlet thread safe?
Answer Posted / sanjay
to make servlet as threas safe we have three approaches
1.do not instance variables into our servlet we use only
local variables
2.by using synchronized methods
3.synchronized blocks
above three ways synchronized blocks is the best way
| Is This Answer Correct ? | 12 Yes | 1 No |
Post New Answer View All Answers
How can the session in servlet be destroyed?
What is load-on-startup in servlet?
What is cookie in servlet?
What is war file?
What is life cycle of Servlet?
What are Servlets?
How can we upload the file to the server using servlet?
Can we use threads in Servlets?
What is the difference between servlet and jsp?
How can you push data from an Applet to a Servlet?
Once the destroy() method is called by the container, will the servlet be immediately destroyed? What happens to the tasks(threads) that the servlet might be executing at that time?
Explain url encoding in servlet?
What are the life-cycle methods for a servlet?
How do we call one servlet from another servlet?
What is meant by Servlet? What are the parameters of service method?