tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gary.l.johnst...@cummins.com
Subject Re: How do you access all sessions from a servlet in tomcat 6.0?
Date Wed, 19 Sep 2007 11:05:02 GMT

Thanks for all the feedback on this.

___________________________

Gary Johnstone
Engineering IT
Cummins Turbo Technologies Ltd
+44 1484 440532






                                                                           
             Lyallex                                                       
             <lyallex@gmail.co                                             
             m>                                                         To 
                                       "Tomcat Users List"                 
             19/09/2007 10:38          <users@tomcat.apache.org>           
                                                                        cc 
                                                                           
             Please respond to                                     Subject 
               "Tomcat Users           Re: How do you access all sessions  
                   List"               from a servlet in tomcat 6.0?       
             <users@tomcat.apa                                             
                 che.org>                                                  
                                                                           
                                                                           
                                                                           
                                                                           




OK, for some reason I've been obsessing about this for a whole day now.

If you hold an external reference to a Session then according to my
tests the session will still time out as expected but the external
reference will be non null. At the very least this means that you may
end up with a large number of useless references taking up space in
memory. Of course you can always remove an invalid or timed out
reference in the sessionDestroyed method of your listener.

There are a whole bunch of other issues surrounding this but I'm sure
you've sussed them out for yourself already.

Anyway, I'll shut up now.

Rgds
Duncan


On 9/19/07, Lyallex <lyallex@gmail.com> wrote:
> On 9/18/07, Lyallex <lyallex@gmail.com> wrote:
> > How about creating a SessionListener
> >
> > class SomeSessionListener implements HttpSessionListener ...
> >
> > Register it in web.xml
> >
> > in the sessionCreated method of your listener get a reference to the
> > new session from the HttpSessionEvent you can now access the
> > getLastAccessedTime(), maybe store the refs in some singleton ...
>
> ...er, actually I think this could be a REALLY STUPID idea as I hadn't
> thought about what happens if you maintain an external reference to a
> session and the session expires...
>
> Investigating now
>
> Duncan
>

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org



_____________
This e-mail transmission and any attachments to it are intended solely for
the use of the individual or entity to whom it is addressed and may contain
confidential and privileged information.  If you are not the intended
recipient, your use, forwarding, printing, storing, disseminating,
distribution, or copying of this communication is prohibited.  If you
received this communication in error, please notify the sender immediately
by replying to this message and delete it from your computer.


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message