• Post Reply Bookmark Topic Watch Topic
  • New Topic

Back to basics with HttpSession

 
PavanPL KalyanK
Ranch Hand
Posts: 212
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Data which is stored in a Session is not thread safe .

What does this mean ? If i set some data in the Session using session.setAttribute(). and

if i am one of the 1000 users accessing a website , can all the other 999 Requests/Threads can access my session data ??
 
PavanPL KalyanK
Ranch Hand
Posts: 212
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I found the answer .

There will be any Threads/Requests from a Single User. All this Threads will be the part of a session making concurrent operations to that Session . so its not Thread Safe .

Am i corresct ??
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 35744
412
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Pavan,
You are correct - that is the main interpretation.

Also, note that you should only put objects into the session that are only used by one user. If you put something else (say a common cache) in there, any of the 1000 users can change it.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!