wood burning stoves 2.0*
The moose likes Servlets and the fly likes Is it a good idea to invalidate a session or remove attribute  to save resource ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Is it a good idea to invalidate a session or remove attribute  to save resource ?" Watch "Is it a good idea to invalidate a session or remove attribute  to save resource ?" New topic
Author

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

Artemesia Lakener
Ranch Hand

Joined: Jun 21, 2005
Posts: 162
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 ?
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

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."


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Is it a good idea to invalidate a session or remove attribute to save resource ?
 
Similar Threads
Forward Cannot Be Achieved In One Step
creating the page Expired
Warning: Page has Expired in Jsp page after clicking back button.
logout when click on the back button on browser
pressing back button after logout shows loggedin contents