| Author |
Thread Saftey in JSF
|
Prem Khan
Ranch Hand
Joined: May 30, 2005
Posts: 189
|
|
I was reading my book "JSF in action" by Kito mann, and it says you must watch out for session scope managed beans to be thread safe. Because other threads can manuipate the values in the same bean. This doesnt make any sence to me, I have many users and iv never had any probblem with my session scope beans. I thought each User has there own instance of the bean. Do you all use session scope beacuse I do
|
 |
Gregg Bolinger
Ranch Hand
Joined: Jul 11, 2001
Posts: 15230
|
|
I'ts not that you have to be careful between users. What that means is that say you put a bean in the session and then the same user spawns several threads that can manipulate that session object. I say again, the same user. That is when you have to be careful. With that being said, I rarely have a managed bean in session scope, though I'll have some objects in session that are used by various managed beans.
|
 |
Prem Khan
Ranch Hand
Joined: May 30, 2005
Posts: 189
|
|
So how can one user spawn several threads ? Is one user really one instance of a web browser ? If thats the case I dont see how one user could spawn more than one
|
 |
George Daswani
Greenhorn
Joined: Sep 28, 2005
Posts: 12
|
|
Open a new Browser window (eq. Mozilla) which shares the session cookies or the double submit problem.
|
 |
Gregg Bolinger
Ranch Hand
Joined: Jul 11, 2001
Posts: 15230
|
|
Originally posted by Shawn DeSarkar: So how can one user spawn several threads ? Is one user really one instance of a web browser ? If thats the case I dont see how one user could spawn more than one
For the most part, you probably don't need to worry about thread safety and managed beans. It's just always a good idea to keep it in the back of your mind.
|
 |
 |
|
|
subject: Thread Saftey in JSF
|
|
|