Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

What is Single Threaded Model in Servlets? Explain this
with an example?

Answer Posted / anjali nema

Typically, a servlet class is instantiated the first time
it is invoked. The same instance will be used over several
client requests, so all members that are declared in that
servlet are shared accross clients. That is what is meant
by multi threaded model, multiple clients that access the
same instance.

There are situations where you want to protect your servlet
member variables from being modified by different clients.
In this case, you can have your servlet implement the
marker interface SingleThreadModel. Every time a client
makes a request to a servlet that implements this
interface, the engine will create a new instance of the
servlet. For performance reasons, the engine can also
maintain a instance pool, handing out instances as they are
needed. Or it could also serialize client requests,
executing a single request.

Is This Answer Correct ?    38 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Which event is fired at the time of project deployment and undeployment?

1264


Describe some assignments that are executed by servlet container?

1032


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

910


What do you mean by request dispatcher in servlet? Also explain its methods.

1093


Explain the servlet filter.

932


What are the functions of Servlet container?

1061


What is the difference between the include() and forward() methods?

1031


Difference between GET and POST?

1088


How can you use a servlet to generate a plain text instead of html?

1078


What's the difference between servlets and applets?

993


Define the servlet mapping.

978


Is java servlet still used?

996


What must be implemented by all servlets?

1044


What do you mean by servlet context?

1059


Why HttpServlet class is declared abstract?

1139