• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ThreadSafe in JSP

 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

if you put isThreadSafe="true" in your jsp..it is like implementing STM so it is discourage right?

i found this(isThreadSafe="true") in my jsp(project)... can i remove this?..when i try this i found no diffence!!! so what i have to do?

please can anyone explain me?
 
Steve Luke
Bartender
Posts: 4181
21
IntelliJ IDE Java Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by seetharaman venkatasamy:
Hi All,

if you put isThreadSafe="true" in your jsp..it is like implementing STM so it is discourage right?

i found this(isThreadSafe="true") in my jsp(project)... can i remove this?..when i try this i found no diffence!!! so what i have to do?

please can anyone explain me?


Yes, it is equivalent to the STM. The problem is that finding threading bugs is hard to do until your code is under heavy load. Once the code goes into production then they pop up easy enough :-(.

You have to scan through the JSP and make sure it isn't doing anything that isn't safe - like accessing static of instance variables (look for variables declared in <%! %> tags), and isn't using classes which use static or instance variables. Then double check any resources that the JSP and its helper classes use and make sure they are safely thread localized. Depending on the JSP this may be easy (if the JSP is for display only it should be easy) or hard (if you are doing a lot of work in the JSP).
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Everything Steve said +
Access to your session and application (context) scoped variables is not necessarily thread-safe either. You would have to examine any code that sets or reads these to make sure that you won't have any concurrency issues.



STM stands for SingleThreadModel by the way.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic