• 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:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

JSP - single threaded

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Servlets can be made single threaded by implementing singleThreadModel , how can a JSP page be made single threaded...
 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
See if this makes sense... I got this extract from a .pdf file I have, I can only find this line the nearest to answer your quesion.

The isThreadSafe attribute controls whether or not the servlet that results
from the JSP page will implement the SingleThreadModel interface. Use of
the isThreadSafe attribute takes one of the following two forms:

<%@ page isThreadSafe="true" %> <%!-- Default --%>
<%@ page isThreadSafe="false" %>
 
Chris Wagnor
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
But read this too...


"It is a common mistake to think that implementing SingleThreadModel makes
JSP thread safe.
This is simply not true.
A web container is free to start more than 1 instance of your JSP page.
If this happens the ThreadSafeModel fails.
With JSP there is no substitute for knowing how to implement a thread
safe web application. "

 
Bartender
Posts: 3735
39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, implementing SingleThreadModel for servlet does make it thread safe as well. so, it's the same as with JSP.

The DEVELOPER is responsible to make servlet or JSP thread safe.

Also, note that starting from 2.4 Servlet API the SingleThreadModel interface is *depricated* and should be avoided (not much use, but posible big problems with performance). This means that DEVELOPER should care of properly threading.

cheers!
MZ
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic