Is is possible (allowable) to destroy and remove an object from the session in JSP and be compliant?  I have some session objects that can be quite large, and there could be various algorithms applied to them to decide when they can be destroyed and made ready for GC.  I know that I can remove attributes from sessions, but I'm not sure if there's a potential bug in doing so since it's not clear that a JSP implementation would have to honor my request (that is, they might hold a reference to my session objects elsewhere within the implementation -- why I don't know, but they might since the spec is not clear to me).
 
Waiting for a session timeout is generally too long.  The big objects are typically the result of a query, and it does make doing prev/next processing very fast.  If the person does another query, the original is destroyed, but if they just leave the site or go to other pages, that session-based query results object will live longer than I'd like.
 
Or is it "safer" for me to have a session object that I can query that contains the reference to my other "session-related" objects so that I can clean them up as needed and leave the session object itself alone?  There's always a solution in code, but I'm curious what others might be doing...
 
Thanks,
David

Reply via email to