tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Leon Rosenberg <>
Subject Re: custom session manager
Date Thu, 06 Oct 2005 09:20:04 GMT
On 10/6/05, Tobias Meyer <> wrote:
> Or, cou could add a static hashmap to your Servlet (or a bean if using JSPs)
> where you simply add the sessions with every request. You would have to put
> an attribute implementing javax.servlet.http.HttpSessionActivationListener
> in each session though, that removes the session from your hashmap when the
> session is expired or you will end up with having many invalid entries in
> your hashmap. (And I don't even know what happens if you keep the references
> to those Session objects when they are recycled by tomcat)
> We do this to keep track of our sessions within the application.

If you keep your sessions in a hashmap forever they will never be
freed by the garbage collector and you will end with an outofmemory
error one day.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message