• 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Is it a good idea to invalidate a session or remove attribute to save resource ?

 
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm thinking that after I use "session" to carry objects among several JSP pages, after I reach the final result page, maybe I should do something like "invalidate" the session or just remove those attributes stored in session, this should free some resources everytime. But the consequence will be --- if I click "back" button to go back to the middleway page, and then click "submit" or "continue" button, I will not get any results because the objects have been removed by me, so I have to go back to the first page and restart everything. What do you experienced guys usually do ?
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are you having memory issues?
If not, I would let the sessions time themselves out.
You've already mentioned one problem with manually removing the objects.
Another is the extra code that you will have to maintain to do this.

Write your app for clarity, then profile it to find it's bottlenecks.
Once you've done that, you can start to optimize by changing things the things that will give you the most bang for the buck. Often, it's not where you think it will be.

As one of our esteemed oldtimers here often says:
"Premature optimization is the root of all evil."
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic