tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Delbecq <delbd+jaka...@oma.be>
Subject Re: How do you access all sessions from a servlet in tomcat 6.0?
Date Wed, 19 Sep 2007 10:04:57 GMT
Just use WeakReference :)

Lyallex a écrit :
> 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
>   

---------------------------------------------------------------------
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