Hi Reinhard,
Thanks for your reply! I wouldn't add a dependency but rather using a simple yet powerful ad-hoc implementation based on LinkedhashMap that allows realizing a memory based LRU cache, I already provided an implementation in Apache Commons Sandbox[1]. If you agree I can start adding it and modifying the components.

About making the mentioned components as CachingPipelineComponent: do you have any hint you can suggest to me please? I'd more than pleased to working on it!
Thanks in advance, best regards!!!



On Mon, Jan 25, 2010 at 8:20 AM, Reinhard Pötz <reinhard@apache.org> wrote:
Simone Tripodi wrote:
> Hi all guys,
> I'd like to improve a little the resources creation into C3 SAX
> pipelines components, saving consumed memory and components
> initialization time, reusing already created resources.
> I mean, instantiating the same kind of XSLTTransformer (or the
> SchemaProcessorTransformer) twice, in different parts of the
> application, with the same resource:
> class Service1 {
>     XSLTTransformer xsltTransformer =
> new XSLTTransformer(this.getClass().getResource("myStyle.xsl"));
>     ...
> }
> class Service2 {
>     XSLTTransformer xsltTransformer =
> new XSLTTransformer(this.getClass().getResource("myStyle.xsl"));
>     ...
> }
> causes the "myStyle.xsl" resource has to be load twice, consuming
> memory. As proposed time ago - also mentioned by Sylvain - I'd like to
> introduce an InMemoryLRU cache that stores and maintains already loaded
> resources.
> What do you think about it? It's a simple improvement I can realize
> quickly and that's not hard to integrate in the existing code, obviously
> any kind of help and suggestion is more than welcome! :)

Yes, improvements in that area are very appreciated. What solution (api)
do you propose?

And when we are at it, it would also be great to support the
CachingPipelineComponent interface in the XSLTTransformer and the

Reinhard Pötz                           Managing Director, {Indoqa} GmbH

Member of the Apache Software Foundation
Apache Cocoon Committer, PMC member                  reinhard@apache.org