How to make servlet thread safe?
Answer Posted / tulasi vani
There are two different ways of making a servlet thread
safe namely
1.By implementing SingleThreadModel.
By implementing a SingleThreadModel it will be possible to
create a Thread safe servlet.There can only be one user at
a given point of time.
2.Synchornize the part of sensitive code.
We can allow a single user at a given point of time by
making that part of the code which is sensitive as
synchronized.
| Is This Answer Correct ? | 127 Yes | 6 No |
Post New Answer View All Answers
What are the differences between the servletconfig interface and the servletcontext interface?
What is life cycle of Servlet?
List some life cycle methods of a servlet.
What are the steps that are required to handle the multi-threading?
What is string tokenizer?
Differentiate between the get and post method
What is URL Encoding?
Write a command to get actual path of a servlet to the server?
How do you get the ip address of the client in servlet?
What are the types of protocols supported by httpservlet ?
Why do we need a constructor in a servlet if we use the init method?
What if we pass negative value in load-on-startup?
Explain Action Servlet?
Is tomcat a servlet container?
What is the use of send redirect () method?