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

What is servlet name in web xml?

955


Which interface should be implemented by all servlets?

1173


Explain the steps involved in placing a servlet within a package?

1005


What is meant by servlet? What are the parameters of the service method?

975


What is SingleThreadModel interface?

1097


Explain their methods? Tell me their parameter names also have you used threads in servlet?

995


What are sessions in servlets?

1030


Explain the features are in servlet 3?

1020


How do I know if java is running on linux?

1068


What are the differences between servlet context vs servlet config?

1033


What are the type of protocols used in httpservlet?

1033


Why is http protocol called as a stateless protocol?

962


Explain url encoding in servlet?

1007


What is servlet instance?

998


Why do we need servlet filter?

1013