File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

SingleThreadModel

 
Chris Salivar
Ranch Hand
Posts: 34
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

If a servlet implements the SingleThreadModel interface then will the instance variable of the servlet be thread-safe?
TIA
- Chris
 
Phil Hanna
Ranch Hand
Posts: 118
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, but it's almost always a poor design to do this. Why do you need instance variables to be persistent? An HTTP session is a much cleaner way to do this. SingleThreadModel does not scale well.
------------------
Phil Hanna
Sun Certified Programmer for the Java 2 Platform
Author of :
JSP: The Complete Reference
Instant Java Servlets
 
Tony Alicea
Desperado
Sheriff
Posts: 3226
5
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes. That's what implementing the model entails.
I am leaving out (since you didn't ask) the details of how a Servlet engine would implement http://java.sun.com/j2ee/j2sdkee/techdocs/api/javax/servlet/SingleThreadModel.html such model.
An I agree w/Phil, BTW.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic