Hi,

One of my WebApp pages needs to make a connection to a remote SOAP service
that uses a String token to identify unique sessions.

When a user reaches that page, my init action acquires a String token for
the SOAP session (via another SOAP object call), and when the user leaves
the page (via buttons/links on the page) I can release the token, allowing
the remote resource to return to it's pool.

If a user leaves my web app some other way (address bar, favorites link
etc..) I don't know they've left until the Tomcat/Struts session timeout.

My problem is that I need to find someway to always know when the user is
done with that page as soon as possible (I have no problem waiting for the
session to timeout) so that I can release the remote resource.

I've tried implementing the finalize method on my connection object (so that
once it goes out of scope, the remote resource is relinquished), however,
from what I've read, this is not a guaranteed mechanism like a destructor in
C++ or Delphi, and in my simple tests it doesn't seem to have been called at
all.

Is there someway in Java/Servlets/Struts to have a method called when an
object is available for the Garbage Collector?  Or some event for when a
session timesout?  Or some other way I can make sure a method is called on
my connection object just before the object is destroyed?

This seems more like a basic Java question, rather than a Struts question,
but I've not been able to find anything in the searches I've performed so
far, and as my object runs within the context of Struts I was hoping that
there might be an answer here.

Note:  I'm not trying to delete or free local objects here, I'm dealing with
a remote resource that needs to receive an event telling it I'm done...

Thanks.

-Chris


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to