users@glassfish.java.net

Session timeout event listener?

From: <glassfish_at_javadesktop.org>
Date: Tue, 25 Sep 2007 10:45:23 PDT

I have a simple application that allows users to relay remote desktop information through a servlet running in glassfish. On doPost a singleton "ImageBufferManager" class is used to get a RemoteDesktopSession object which caches the image data, it looks something like this

ImageBufferManager.getImageBufferManager().getRemoteDesktopSession ("3F4CAS");

where "3F4CAS" would be a randomly generated code, getRemoteDesktopSession(String Key) simply returns the RemoteDesktopSession object correlating to the given keycode from a hashmap. Obivously the returned RemoteDesktopSession instance has my methods for getNextImage() and setNextImage().

Everything seemed to be working great except that I need a method to call .remove("whatever key") on my hashmap to remove my RemoteDesktopSession instances as they are no longer needed. This would be done nicely when my client program closes tidily, however a crashed client computer would leave the object hanging in memory forever (as I would need to remove the reference to it from my manager class). What I need to know is what the best method to be notified of a HTTP session timing out, getting the key parameter from it, and using this to remove the session from my Manager class.

Any help is appreciated, this is the last step in getting my application working.
[Message sent by forum member 'benju' (benju)]

http://forums.java.net/jive/thread.jspa?messageID=236995