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 <[EMAIL PROTECTED]> wrote:
On 9/18/07, Lyallex <[EMAIL PROTECTED]> 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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]