Alex Smith wrote:
> "Saving" sessions via a singleton wont work if they're swapped in and
> out of memory (read: persisted) as you will have the same session
> object by value but not by reference. Session persistence is a fairly common
> thing nowadays.
Right, but on JRun at least that mechanism appears to kick in only
on server shutdown, which of course the singleton approach does not
deal with anyway. It also does not handle sessions spread across
multiple VMs. It's a quick workaround for the deprecated
HttpSessionContext stuff.
> A valid scenario for enumerating through all sessions is when you
> need to shut down the service and clean up the sessions. Let's say
> your application consists of EJB beans accessed by HTTP and non-HTTP clients
> and you want to shut down the HTTP channel. "Clean" shutdown requires you to
> invalidate() all active sessions so the listeners fire, at the very least. I
> dont see this scenario being taken care of in 2.1 or 2.2 spec but perhaps I
> am missing something.
You could always roll your own by having the objects stored in
the session listen for a service shutdown event and free their
resources either that way or if they are unbound from the session.
The objects in the session themselves don't get GC'ed right away,
but you can have them get rid of all their state.
Rod McChesney, Korobra
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html