Hi Kenneth, The SOAP service maintains the state of the "object" I'm interacting with. It maintains a pool of the objects, but dedicates an object once it's in use. I don't have a persistent/stateful SOAP session, it's the handle I get, and use with all subsequent calls, that makes sure I'm dealing with the same resource on the remote server.
It's not the SOAP session that I've acquired, so much as a handle to an object being managed by the remote SOAP service. When the user is done with my page, I need a way to tell the remote SOAP service that it can return the object back to the pool. Problem is, I don't see a way to handle the "loss" of the HTTPSesion object. Am I making better sense? -Chris > -----Original Message----- > From: Kenneth Stout [mailto:[EMAIL PROTECTED]] > Sent: Monday, June 24, 2002 6:52 PM > To: Struts Users Mailing List; [EMAIL PROTECTED] > Subject: Re: How to finalize a custom connection object? > > > Chris, > > Why are you holding onto the SOAP service? > > If I understand your explanation correctly you get a request from a user, > obtain a SOAP session, obtain information via SOAP, send the > response back; > then wait for the user to go somewhere else before you release the SOAP > session. Why not release the SOAP session just prior to sending > the response > back? > > If you are worried about performance having to open/close a SOAP > session for > multiple accesses to this page in your application you may what to think > about creating a pool of SOAP sessions and hold a small number of SOAP > sessions open for longer periods of time. The pool could then handle the > opening and closing of SOAP sessions as needed. Having a small number of > SOAP sessions always open may provide a performance improvement for your > site as well. Overall that may prove to be a better utilization > of the SOAP > server in the long run. > > Kenneth. > > ----- Original Message ----- > From: "Chris Means" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Monday, June 24, 2002 3:34 PM > Subject: How to finalize a custom connection object? > > > > 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]> > > > > > -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>