• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Concurrency in JSF managed bean

 
Joshua Antony
Ranch Hand
Posts: 254
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?

Regards,
Joshua
 
Piotr Swiecicki
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 254
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?

Regards,
Joshua
 
Bob Good
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic