aspose file tools*
The moose likes Servlets and the fly likes servlets multithreading  concept doubt Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "servlets multithreading  concept doubt" Watch "servlets multithreading  concept doubt" New topic
Author

servlets multithreading concept doubt

yuvraj kotegar
Ranch Hand

Joined: Jul 31, 2008
Posts: 120
Hi Friends,
is it always that no matter how many requests come from different clients for one particular SERVLET instance only new threads are created to serve it??
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61606
    
  67

Pretty much, yes. There's wiggle room in the Spec (unless that's changed) for containers to create multiple instances as they see fit, but from the developer's point of view, your code needs to be written so that multiple threads can access a single servlet instance.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
yuvraj kotegar
Ranch Hand

Joined: Jul 31, 2008
Posts: 120
oh you mean to say that we can create more then one instance of the same servlet which can serve different clients also. so this is also a possibility.

But in mormal situations only one instance is loaded and it creates multiple threads to serve clients.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61606
    
  67

As developers you have little control over the inner workings of the container, but yes, assume a single instance is created.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: servlets multithreading concept doubt