Have you tried making any objects you intend to keep in session implement the javax.servlet.http.HttpSessionListener interface? Then, when an object is destroyed, you could have defined the "void sessionDestroyed(HttpSessionEvent se)" method to close down any dependencies or zero out any data before garbage collection.
I think this is a servlet 2.X thing so various Java applications servers probably support it. Regards, David -----Original Message----- From: lixin chu [mailto:[EMAIL PROTECTED] Sent: Friday, October 15, 2004 8:33 PM To: Struts Users Mailing List Subject: RE: mechanism to clear objects in the session thanks. I will think about it. it is new to me. googled, and find http://www.codeguru.com/java/tij/tij0051.shtml whih has an example. --- "McCormack, Chris" <[EMAIL PROTECTED]> wrote: > I haven't tried this yet, but maybe any objects that > you intend to put in the session should have a nice > finalize section to tidy themselves up before being > removed by GC. You could then effectively force GC > on these objects by System.runFinalization() when > you needed without keeping track of what you are > putting in the session. > > Just having a muse over morning coffee, don't know > how practical/viable this solution is :) > > Chris McCormack > > -----Original Message----- > From: lixin chu [mailto:[EMAIL PROTECTED] > Sent: 15 October 2004 10:05 > To: Struts Users Mailing List > Subject: Re: mechanism to clear objects in the > session > > > thanks. it indeed helps me, in fact the points are > critical - i need to think my use cases twice, and > you > have also pointed out a couple of choices. i will > try > to come out a cleaner implementation in my system. > thanks again ! > > > > --- Erik Weber <[EMAIL PROTECTED]> wrote: > > > There was no common solution discussed that I > > recall. But, the idea is, > > put a class to work in a place where it can > monitor > > every request. For > > example, in a Servlet Filter, or in a Struts > > RequestProcessor subclass, > > or an Action base class. As far as I know, there > is > > no existing > > framework or common utility for doing this sort of > > thing. I have found > > that using a common naming convention (or even a > > common key) for these > > types of session attributes makes programming the > > cleanup easier. > > Tracking page flow and deciding what's going with > > the flow and what's > > going against the flow is up to you. > > > > A real simple first implementation might be to > clean > > out all session > > attributes (such as forms) that are considered > > "working" attributes (not > > those, such as "user" objects, that are needed for > > the lifetime of the > > session) whenever the user returns to the "home" > > page (in your "home" > > Action). > > > > It is worth noting that good navigation design > > inherently makes this > > sort of thing easier. Applications should have > > "home" views, and > > sections of the application should have their own > > "home" views. When the > > user finishes a task, he returns to the home view > > for the section he's > > using, or to the main home view. This is where you > > can do cleanup (while > > you are preparing the home view). > > > > Or not. The particular design isn't really > relevant. > > The point is to > > design *something*, to think it through ahead of > > time, instead of just > > drawing pages and making them "work". > > > > Sorry I didn't help much. > > > > Erik > > > > > > > > lixin chu wrote: > > > > >Hi, > > >I saw an ealier thread discussing this but still > > can > > >not fully understand the solution. > > > > > >appreciate if any one can provide some more > > detailed > > >info on this. basically if the current page flow > is > > >terminated for some reason, how the Struts > > application > > >can clear the objects stored in the session ? > > > > > >thanks > > >li xin > > > > > > >__________________________________________________ > > >Do You Yahoo!? > > >Tired of spam? Yahoo! Mail has the best spam > > protection around > > >http://mail.yahoo.com > > > > > > >--------------------------------------------------------------------- > > >To unsubscribe, e-mail: > > [EMAIL PROTECTED] > > >For additional commands, e-mail: > > [EMAIL PROTECTED] > > > > > > > > > > > > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: > > [EMAIL PROTECTED] > > For additional commands, e-mail: > > [EMAIL PROTECTED] > > > > > > > __________________________________________________ > Do You Yahoo!? > Tired of spam? Yahoo! Mail has the best spam > protection around > http://mail.yahoo.com > > --------------------------------------------------------------------- > To unsubscribe, e-mail: > [EMAIL PROTECTED] > For additional commands, e-mail: > [EMAIL PROTECTED] > > > *********************************************** > This e-mail and its attachments are confidential > and are intended for the above named recipient > only. If this has come to you in error, please > notify the sender immediately and delete this > e-mail from your system. > You must take no action based on this, nor must > you copy or disclose it or any part of its contents > to any person or organisation. > Statements and opinions contained in this email may > not necessarily represent those of Littlewoods. > Please note that e-mail communications may be > monitored. > The registered office of Littlewoods Limited and its > subsidiaries is 100 Old Hall Street, Liverpool, L70 > 1AB. > Registered number of Littlewoods Limited is 262152. > ************************************************ > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: > [EMAIL PROTECTED] > For additional commands, e-mail: > [EMAIL PROTECTED] > > __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]