This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
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
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