• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

HFJS question 13 page 214

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
For me, there is no correct answer. Is there only one instace of a servlet with different thread for each request? no matter whether the servlet is SingleThreadModel or not.

Can anyone tell me why A and D are correct please?

Any help is very appreciated!!
 
Ranch Hand
Posts: 1026
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
For each incoming request container creates a seperate thread to handle the request. For example 10 users access the same servlet resource then 10 threads will be created by the container but there will be only one instance of that servlet.

Whereas when your servlet implements SingleThreadModel no more than one thread can access your servlet. It's just lik synchronizing your service method. So the container creates sepeate instance for every incoming request. with SingleThreadModel concurrency(multiple threads accessing the same resource) is severely affected. So it is appreciable NOT to use SingleThreadModel. Thats the reason why they had deprecated it from servlet spec 2.4
 
Jeff MacDonald
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Vishnu. Now I get it.
 
I don't even know how to spell CIA. But this tiny ad does:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic