cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oscar Picasso <oscgoo...@yahoo.com>
Subject Re: What make cocoon call the 'configure' method?
Date Fri, 09 Apr 2004 18:44:07 GMT

--- Gianugo Rabellino <gianugo@apache.org> wrote:
> Oscar Picasso wrote:
> 
> > Hi,
> > 
> > 1- On one hand I have a custom generator that extends the velocity
> generator
> > and implements 'Configurable' and 'CacheableProcessingComponent'. It works
> fine
> > and in particular the 'configure' method is called one time only.
> > 
> > 2- On the other hand I have an action that implements 'Configurable'. But
> in
> > that case each time I use the action, its 'configure' method is called. As
> the
> > 'configure' method makes some expensive processing I would like my action
> to
> > behave like the generator above ==> configure method called only the first
> time
> > it is used.
> > 
> > So my question is: what are suppose to do to 'tell' cocoon to configure our
> > component only the first time it used?
> 
> This is not Cocoon but Avalon. The Avalon contracts state that 
> configure() will be called only once during the lifecycle of the 
> component, and you can take that for granted. What seems to be to you a 
> repeated configure() call is probably due to the container that doesn't 
> use object pools on your component but creates them on demand. So, 
> actually, configure() is called only once but in your Generator case 
> your instances are reused (configure() was already called), while your 
> Action instances are created (and destroyed) on every call. Consider 
> implementing Poolable.

If have tested with Poolable but it didn't work (I didn't test that solution
extensivly though).

Finally, if I implement 'Recyclable', with a recycle method that does nothing.,
I get the right behaviour.

Is there some danger in using 'Recyclable' that way?

Thanks 

Oscar

__________________________________
Do you Yahoo!?
Yahoo! Small Business $15K Web Design Giveaway 
http://promotions.yahoo.com/design_giveaway/

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message