cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Berin Loritsch" <blorit...@infoplanning.com>
Subject Re: [C2]: Dispose of sitemap components
Date Wed, 29 Nov 2000 23:59:25 GMT
----- Original Message -----
From: Giacomo Pati <pati_giacomo@yahoo.com>
To: <cocoon-dev@xml.apache.org>
Sent: Wednesday, November 29, 2000 7:17 AM
Subject: Re: [C2]: Dispose of sitemap components


>
> --- Carsten Ziegeler <cziegeler@sundn.de> wrote:
> > Hi,
> >
> > what do you think of a dispose() method for each sitemap component
> > (generator, transformer, serializer etc) as an equivalent to the
> > setup() method?
> >
> > The dispose() method would be called after the pipeline has finished
> > and each component has the chance to clean up.
> > This is especially important if an exception occurs in the pipeline:
> > If the generator throws an exception none of the following components
> > get aware of this.
> > If for example the SQLTransformer has already opened the connection
> > this will never be closed properly, because if the components are
> > pooled they will not garbage collected.
> >
> > If there is interest I would write voluntarely the patches for the
> > components (adding a dispose() method with no parameters).
>
> Well, I don't see this will hurt the architecture in any way. But I
> suggest you use the Avalon interfaces Disposable for that.
>
> Berin, any addition to this would be appriciated :).

Definitely use the Disposable Interface.  I would have to double check,
but the Avalon Pool system checks for Dispose interface to properly
handle those things when the Object is returned to the pool.

> Also take into account that for pooled Component there is the
> Recyclable interface for exact that reason. The recycle methed gets
> called when the component is put back into the pool. May this will help
> too.

Any pooled component should not depend on the garbage collector to
clean up after it.  It either needs to clean up after itself, or it needs to
implement the Disposable/Recyclable interface to perform the cleanup.

Which Pool are you using?
org.apache.avalon.utils.recycle or org.apache.avalon.util.pool?

The util.pool package is the one we are going to use in the future, and
has been optimized to be quicker than recycle.


Mime
View raw message