Win a copy of Rust Web Development this week in the Other Languages forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

Managed ben doubt

 
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

In my application all the managed beans are in scope session. Will it cause any performance issue? Do we need to serialize this bean objects.

Can anyone tell me the best approach. I am using jsf1.2

Thanks.
 
Bartender
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well yes. The data must be stored somewhere, in memory or on disk.
Only data that needs to be stored you should store and for other classes you should make them stateless.
 
Saloon Keeper
Posts: 24829
172
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you have a choice, you should use request scope instead of session scope. That's because the server has to keep objects on a long-term basis, and the more objects you're keeping, the more RAM it eats up. Request scope objects exist only while a request is active, so they take a smaller "bite",

However, JSF does tend to force you to use session scope in a lot of cases where you wouldn't otherwise have to. JSF2 eases some of this by adding View scope.

Session scope objects (including non-JSF session-scope) objects need to be serializable. Some appservers will get very annoyed if you don't declare session objects as serializable. That's because if the appserver needs to free up memory by "paging" objects out or if the appserver needs to transfer the session to another VM, the data must be serialized/deserialized.

Of course, if you say something's serializable, you must mean it. Otherwise, if the data goes through serialization/deserialization, the deserialized copy of the object may be missing critical information.
reply
    Bookmark Topic Watch Topic
  • New Topic