Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

request atributes are always thread-safe?

 
Steven Colley
Ranch Hand
Posts: 290
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
a question,

are the request "attributes" even thread-safe always?

tks.
 
Vivek Kinra
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Felipe,

Request attribute are always thread safe but session and context are not.
 
Narendra Dhande
Ranch Hand
Posts: 951
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I think, therotically correct but not practically. Think if you have referenec to request attribute object and updating some properties throug this reference in another thread.


Thanks
 
Aleksander Zielinski
Ranch Hand
Posts: 127
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check this thread:

http://www.coderanch.com/t/171831/java-Web-Component-SCWCD/certification/request-scope-attributes-thread-safe


Anyway, I did a small test:







In result.jsp dog's name is "NEW NAME", so it looks like they are thread safe, even though we still have the reference in One to the request object we can't set new value for this attribute's property "name".
 
Steven Colley
Ranch Hand
Posts: 290
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI Aleksander ,

btw, nice thread.

but for the exam...should we say that "request attributes" are thread-safe, aren�t we?

Tks.

 
Ganesh.P Ram
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Request attributes and local variables in service methdos are thread safe.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic