• 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

SingleThread Model is deprecated in 2.4

 
Ranch Hand
Posts: 312
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
1) What is the advantages/disadvantages of using Single Thread Model.
- I feel instead of implementing SingleThreadModel we can put the particular codes in the synchroized block, which avoids the overhead. Am I correct?
2) What is the advantages of using Instance pooling model instead of single instance request model?
3) Since SingleThreadModel is deprecated then whether Servlet instance pooling model is still available? If so how to configure instance pooling in the weblogic server.
Thanks & Regards,
M.S.Raman.
 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi...this is what was written in java.sun.com
RonCrawford_II: Why is the SingleThreadModel interface and option in JSP when the Java platform offers the synchronized keyword? What are the benefits of placing synchronization on the JSP engine?
Marty: Well, SingleThreadModel gives the server more flexibility than you would have if you manually synchronized all your code in service or _jspService. For example, a server can queue up requests to a single servlet instance or make multiple servlet instances and send requests concurrently (as long as a single instance gets only one request at a time). That all being said, I do agree that in general it is better NOT to use SingleThreadModel and to synchronize access to shared data yourself.

bye dude
 
Ranch Hand
Posts: 1561
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
1) What is the advantages/disadvantages of using Single Thread Model.
I can't see any advantage. Disadvantage, many. The main one, performance.
- I feel instead of implementing SingleThreadModel we can put the particular codes in the synchroized block, which avoids the overhead. Am I correct?
hmmm yes. But it also depends on what exactly you want to sinchronize. For instance, it doesn't make sense to synchronize the service() method.
2) What is the advantages of using Instance pooling model instead of single instance request model?
what is "instance pooling model?". If your talking about SingleThreadModel, then the container may create several servlet instances and each thread will execute on its own instance.
3) Since SingleThreadModel is deprecated then whether Servlet instance pooling model is still available? If so how to configure instance pooling in the weblogic server.
SingleThreadModel is deprecated in servlet 2.4 only. I'm not sure whether there are servlet containers that create multiple instances of a servlet when running with multithread model. You shouldn't configure instance pooling, I think that's the container's job. Your job is to make sure that the servlet is thread safe, without the need of implementing SingleThreadModel (using local variables, avoiding static variables, etc).
hope this helps
 
Malli Raman
Ranch Hand
Posts: 312
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Andres Gonzalez:
1) What is the advantages/disadvantages of using Single Thread Model.
I can't see any advantage. Disadvantage, many. The main one, performance.
- I feel instead of implementing SingleThreadModel we can put the particular codes in the synchroized block, which avoids the overhead. Am I correct?
hmmm yes. But it also depends on what exactly you want to sinchronize. For instance, it doesn't make sense to synchronize the service() method.
2) What is the advantages of using Instance pooling model instead of single instance request model?
what is "instance pooling model?". If your talking about SingleThreadModel, then the container may create several servlet instances and each thread will execute on its own instance.
3) Since SingleThreadModel is deprecated then whether Servlet instance pooling model is still available? If so how to configure instance pooling in the weblogic server.
SingleThreadModel is deprecated in servlet 2.4 only. I'm not sure whether there are servlet containers that create multiple instances of a servlet when running with multithread model. You shouldn't configure instance pooling, I think that's the container's job. Your job is to make sure that the servlet is thread safe, without the need of implementing SingleThreadModel (using local variables, avoiding static variables, etc).
hope this helps


Thanks praveenkumar singamsetty , Andres Gonzalez.
Regards,
M.S.Raman
 
Oh the stink of it! Smell my tiny ad!
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic