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


Please Help Members By Posting Answers For Below Questions

Servlet is pure java object or not?

719


What do you mean by annotations in servlet?

580


How do I use cookies to store session state on the client?

534


How can an existing session be invalidated?

659


What are the uses of servlets?

619






Which method of the httpservletrequest object is used?

561


What is servletconfig?

544


What are the various ways of session supervision in servlets?

519


What is the use of request dispatcher interface?

567


What is Servlets and explain the advantages of Servlet life cycle?

579


Which event is fired at the time of session creation and destroy?

868


How do we translate jsp?

569


What is the use of welcome-file-list?

571


What is cgi?

594


What are the advantages of cookies?

628