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 features added in Servlet 2.5?
What do you mean by scope object and what are its types?
How to notify an object in session when session is invalidated or timed-out?
What is the importance of init() method in Servlet ?
Explain the architechure of a servlet?
What is the need of session tracking in web application?
Which are the different ways you can communicate between servlets?
What is the procedure of invoking different servlet in a different application?
What is servlet name in web xml?
What is the use of httpservletrequestwrapper?
Why is Servlet so popular?
Can we fetch the attributes related to a servlet on a different servlet?
What is Servlets and explain the advantages of Servlet life cycle?
What is difference between cookies and httpsession?
If a servlet is not properly initialized, what exception may be thrown?