• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

true or false......implicit obj's threadsafe?

 
faiza haris
Ranch Hand
Posts: 173
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
All implicit objects are threadsafe?
My ans: yes
since they can be declared in scriptlets and expressions only i.e in _jspService() method so as local var are threadsafe, they too r threadsafe?
Is it right or am i missing some point?
thanx
faiza
 
Axel Janssen
Ranch Hand
Posts: 2166
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
good question!
Under the circunstances that the implicit object has as an attribute an instance variable, which is not only read in _jspService() but to which a new value is asigned, it is n o t threadsafe.
I think.
Correct me if I am wrong.
Axel
 
salman 2020
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Although the implicit objects are local the attributes set in these objects may be instance variables or class variables accesible to other implicit objects as well thus nullifying the thread safe concept
Suppose the _jspService method creates an implicit object request and then add to it's attributes a static object which is accessible to other request objects thus nullifying the thread Safe concept.
Well it depends on how you design your JSP taking into consideration all the aspects of making best use of thread safe concept.
 
Madhav Lakkapragada
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, all implicit objects are NOT thread safe, session, application for example.
application we know ia an implicit obj.
All JSP's in your web-app can access it. Do you
think that is thread safe?
We also know that the _jspService(...) method doesn't implement SingleThreadModel by default.
So......
- satya
 
faiza haris
Ranch Hand
Posts: 173
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hmm.......
So which ones are threadsafe!
Spoonfeed me plz
 
Madhav Lakkapragada
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
anthing that cannot be shared with other JSP/Servlets simultaneously.
local variables.
request parameters.
things like that....anything else pl. add to the list.
- satya
 
Axel Janssen
Ranch Hand
Posts: 2166
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Instance variables that are only read (not asigned with a new value).
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic