• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

isThreadSafe="false"

 
Max Tomlinson
Ranch Hand
Posts: 365
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Am I the only one that thinks this sounds backwards?
Doesn't isThreadSafe="true" sound like single threaded?
from the spec:
Indicates the level of thread safety implemented in the page.
If �false� then the JSP container shall dispatch multiple
outstanding client requests, one at a time, in the order they
were received, to the page implementation for processing.
If �true� then the JSP container may choose to dispatch
multiple outstanding client requests to the page
simultaneously.
Page authors using �true� must ensure that they properly
synchronize access to the shared state of the page.
Default is �true�.
Note that even if the isThreadSafe attribute is �false� the JSP
page author must ensure that accesses to any shared objects
are properly synchronized., The objects may be shared in
either the ServletContext or the HttpSession.
 
Rishi Singh
Ranch Hand
Posts: 321
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Max,
How do we synchonize the instance variable i.e anything which we
put it in a jsp:declaration <%!String s="rishi";%> and the value of isThreadsafe attribute is default (true)
 
Max Tomlinson
Ranch Hand
Posts: 365
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Best way, I think, is to make the JSP thread safe. Perhaps you could declare a method that would be synchronized that accesses the instance variable and declare the instance variable as private.
Anybody else know the asnwer to this?
Max
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic