• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

How many instances of servlet and threads will be created

 
Ranch Hand
Posts: 486
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

When i open servlet application on ten different computers ,
1. how many nstnaces of servlet will be created
2. How many threads will be created.

Can yoou please explain me in detail.


Please. .....
 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I assume you are talking about accessing same servlet from different computers and your servlet is not implementinng Single Thread Model.

In this case only one instance of servlet will be created. Depend upon how many requests you send to that servelt, that many number of threads will be generated. If you are sending 10 requests , 10 threds will be started by the server.

If your servlet implments Single Thread Model then picture changes little bit.

Hope this helps.

Thanks
 
Dinesh Tahiliani
Ranch Hand
Posts: 486
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You mean to say only one servlet instance and 10 different threads.

What do you mean different in Single Thread model.
Can you give me summary of that please
 
Ranch Hand
Posts: 105
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, SingleThreadModel was introduced in the first place for thread safety. When a servlet implements SingleThreadModel, the container guarantees that only single Thread of the Servlet would be executed in a given instance of time. Having said that, the reason for deprecating SingleThreadModel is for shouldering the responsibility of Thread safety of the servlet on the developer, without implementing SingleThreadModel. With SingleThreadModel deprecated, it becomes developer's responsibility to safe guard the non-thread safe aspects a servlet.
 
Don't listen to Steve. Just read this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic