Levi,

The view/JSP does not acquire the resource.  Here is a sample of how the
code use to work pre-struts:
    Servlet.doGet()
    {
        ...
        rs <- <dbquery>
        request.setAttribute("rs", rs)

        requestDispatcher.include(<jspFile>)

        rs.close();
    }

    In JSP:
        ...
        rs = request.getAttribute("rs")
        while (rs.next())
        {
            ...
        }

- - -

The problem is that there is no appropriate counterpart in the world of
struts.  Sure, I can copy the row data to a collection and then walk the
collection.  But for various reasons, this may be inappropriate (especially
for large result sets represented by a cursor).

Finally, you should not depend on garbage collection.  The garbage collector
is not always called and its certainly not called as often as you would want
it to when you need to free scarce resources like db handles.

- jeff


----- Original Message -----
From: "Cook, Levi" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, June 05, 2001 1:40 PM
Subject: RE: Managing resource life cycle during request


> Can you elaborate on your resource cleanup requirements?
>
> My view on designing a responsible object is that I must make sure it
> eventually releases any, non-memory, finite resources it uses. This design
> strategy, coupled with garbage collection ensures my system doesn't run
out
> of those resources (eg. file handles, sockets, etc.).
>
> Given that ActionForms and JSPs should play the "view" role in Struts, I
> would question a design that has them acquiring non-memory resources. But,
> alas, I don't know your system or situation..
>
> Regards,
> Levi Cook
>
>
> -----Original Message-----
> From: Ted Husted [mailto:[EMAIL PROTECTED]]
> Sent: Monday, June 04, 2001 10:31 PM
> To: [EMAIL PROTECTED]
> Subject: Re: Managing resource life cycle during request
>
>
> I doubt that overriding ActionServlet.process() would work. The
> controller sends back the response, and it's done. It's then up to HTTP
> to deliver the view, usually a JSP.
>
> Any clean-up routine would have to be the responsibility of the view,
> which puts you into the scriplet zone.
>
> Jeff Trent wrote:
> >
> > Well, it looks to me that short of overriding ActionServlet.process(),
> there
> > is no way one can clean-up resources after the page has been rendered...
>

Reply via email to