aspose file tools*
The moose likes JSP and the fly likes ThreadSafe in  JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "ThreadSafe in  JSP" Watch "ThreadSafe in  JSP" New topic
Author

ThreadSafe in JSP

Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

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

Joined: Jan 28, 2003
Posts: 4181
    
  21

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).


Steve
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

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.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: ThreadSafe in JSP