File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSF and the fly likes Concurrency in JSF managed bean Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "Concurrency in JSF managed bean" Watch "Concurrency in JSF managed bean" New topic

Concurrency in JSF managed bean

Joshua Antony
Ranch Hand

Joined: Jun 05, 2006
Posts: 254
Hi All,

We have several JSF managed beans in our applications which consist of many instance variables.

Are the beans thread safe, I mean if 5 jsf uses same bean then will it be 5 bean object created or just a single object and 5 different threads?


Piotr Swiecicki

Joined: Nov 16, 2006
Posts: 17
They are thread safe unless you not bind them to the session/application scope. In that case it may happen that 2 requests will operate on the same bean instance.
Joshua Antony
Ranch Hand

Joined: Jun 05, 2006
Posts: 254
Forgot to mention, all the beans in our application are session scoped.

I guess 2 request will operate on the same bean instance only if both request are from the same client, right?

Bob Good
Ranch Hand

Joined: Jan 09, 2008
Posts: 86
One thing can happen in Internet Explorer if a user chooses 'open in new window' is that the new windows gets the same session id as the original windows. These windows would then be going after the same managed beans.
There are many situations where this can wreak havoc unless you handle it.
I agree. Here's the link:
subject: Concurrency in JSF managed bean
Similar Threads
JSF bean container
Design flow question ?
can I get the request object in managed bean?
Injection problem - not quite sure if this is something i should be using injection for
How to get session scope backbean