Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HttpSession concept

 
nippon ask
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, i'm getting weird things on my user sessions, so i was wondering...
...Is the HttpSession thread-safe?
I'm having users objects 'setted' on other users sessions, so, may it be that i need to enclose the code in a 'synchronized' block?
I'll appreciate any help...
R
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13074
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sessions are not automatically Thread-safe, but should be unique to individual users. Confusion of objects between users is almost certainly due to bad program architecture and will not be helped by synchronization.
The only time you should have to worry about synchronizing access to objects in sessions is when you have the possibility of processing multiple requests from the same user "at the same time" - for example with frames or where images are being generated.
Bill
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic