• 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

Question regarding SingleThreadModel

 
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In one E - Book i have read that -:

" Recall that multiple client requests to the same servlet result only
in multiple threads calling the service method of a single servlet instance.
They do not result in the creation of multiple servlet instances except possibly when the servlet implements SingleThreadModel."

In above it is written that it will create multiple instance of Servlet if we implements SingleThreadmodel, but i think that only one instance of servlet is created , so how is it possible that many instance of one servlet will be created, it will nullify the usuage of servlet if it will create many instance of the same servlet.

Thanks
Regards
Gaurav
 
Ranch Hand
Posts: 1140
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
From the Java API on SingleThreadModel


As you can see, whether to create a single instance (and to provide a synchronized access) or to create multiple instances, depends on the implementation of the Servlet container.
But if multiple instances are created, the containers generally pool them to improve the performance.
[ November 23, 2005: Message edited by: Mani Ram ]
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Gaurav,

This thread from last week might interest you.
In it, singleThreadModel was discussed quite a bit.

https://coderanch.com/t/361606/Servlets/java/Pooling-Servlet
 
So you made a portal in time and started grabbing people. This tiny ad thinks that's rude:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic