glassfish_at_javadesktop.org wrote:
>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.
>
>
Try implementing a javax.servlet.http.HttpSessionListener, and declare
it in your
deployment descriptor. The container will invoke its sessionDestroyed()
method
whenever a session expires or is invalidated. You can retrieve the
session from
the HttpSessionEvent that is passed as the argument to the
sessionDestroyed()
method.
Jan
>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
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
>For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>
>