|
List Info
Thread: Question on component caching / reuse
|
|
| Question on component caching / reuse |
  France |
2007-05-26 02:23:44 |
[re-sent - didn't make it to the list ?]
Hi all,
I have a question regarding components reuse or caching.
After looking
at the code, I have the feeling that at the end of the
rendering phase,
destroyCycle() is called on every component. This will null
references
to children, views, ... So it seems to me that it would be
difficult to
cache / reuse components (in a servlet session, for example
for a part
of the UI like a toolbar).
So here is my question :
- does anyone cache components in his/her app (ie reuse the
same
instance of a component on several request/response cycles)
?
- does anyone remember if this is supposed to be possible or
not ? On
that matter, I have found a tread on the subject here :
http://osdir.com/ml/java.enhydra.barracu
da.general/2002-11/msg00084.html
(but well, it was in 2002...)
- is this desirable ? If not why ?
- should the destroyCycle() be more more conservative, ie
destroy only
references to stepChildren (not regular children) or
tempViews (not
regular views) ? destroyCycle() is here to prevent memory
leaks, so I
would rather be conservative with it, but maybe it could be
enhanced to
promote components reuse...
Any thought on this ?
Franck
|
|
|
| Re: Question on component caching /
reuse |
  United States |
2007-05-26 09:03:21 |
Component caching doesn't sound bad, as long as it can be
turned off. In
fact since it wasn't on before, it should be off by default.
I can see
where this could be very useful. Our applications current
way of
rendering pages includes what we call our MasterTemplate.
This template
sets up the overall look of our page. i.e. it create context
sensitive
menus, titles, icons, style sheets, etc.... Then we have
individual
pages with supplies the content. I can see where caching
this master
template would be advantageous, as long as we could render
it with a new
model on each request. For my particular use of Barracuda,
we are
somewhat limited on memory usage, doing a lot of in-memory
caching would
not be too good for me.
Denny
Franck Routier wrote:
> [re-sent - didn't make it to the list ?]
>
> Hi all,
>
> I have a question regarding components reuse or
caching. After looking
> at the code, I have the feeling that at the end of the
rendering phase,
> destroyCycle() is called on every component. This will
null references
> to children, views, ... So it seems to me that it would
be difficult to
> cache / reuse components (in a servlet session, for
example for a part
> of the UI like a toolbar).
>
> So here is my question :
>
> - does anyone cache components in his/her app (ie reuse
the same
> instance of a component on several request/response
cycles) ?
>
> - does anyone remember if this is supposed to be
possible or not ? On
> that matter, I have found a tread on the subject here
:
> http://osdir.com/ml/java.enhydra.barracu
da.general/2002-11/msg00084.html
> (but well, it was in 2002...)
>
> - is this desirable ? If not why ?
>
> - should the destroyCycle() be more more conservative,
ie destroy only
> references to stepChildren (not regular children) or
tempViews (not
> regular views) ? destroyCycle() is here to prevent
memory leaks, so I
> would rather be conservative with it, but maybe it
could be enhanced to
> promote components reuse...
>
> Any thought on this ?
>
> Franck
>
>
>
>
>
------------------------------------------------------------
------------
>
>
> --
> Barracuda mailing list
> Barracuda objectweb.org
> http://www.objectweb.org/wws/lists/projects/barracuda
>
|
|
|
| Re: Question on component caching /
reuse |
  France |
2007-05-31 05:55:55 |
Hi Denny,
you get the point of what I am meaning : not really caching
components
in the sense that Barracuda would do that beyond the scene
without the
developper taking care of it, but rather giving the
developper the
opportunity to reuse an instance of a component during
several req/resp
cycles (of course with updated models backing them if
needed).
Right now this is simply impossible and leads to NPE in
several places
in Barracuda.
I have tried to modify destroyCycle() on my local copy of
Barracuda by :
- not setting children to null but rather call
removeAllStepChildren()
- not setting view to null but rather call removeAllViews()
- not setting parent to null but rather let removeChildren()
do that on
removed children...
I don't know what to do with statemap and with models for
components
backed by models...
So far this enables me to reuse components, but the whole
point is to
avoid reopening memory leaks in Barracuda...
What I have in mind is that only the developpers should use
addChild().
Then he/she would be responsible for removing them when
necessary (maybe
Barracuda should provide a deepDestoyCycle method or
something).
The framework would only use addStepChild() and stepChildren
would be
removed after each rendering.
I will makes tests and try this... but any comment is
welcome, as I am
not too sure I not opening Pandora's box
Franck
Le samedi 26 mai 2007 à 09:03 -0500, Denny Chambers a
écrit :
> Component caching doesn't sound bad, as long as it can
be turned off. In
> fact since it wasn't on before, it should be off by
default. I can see
> where this could be very useful. Our applications
current way of
> rendering pages includes what we call our
MasterTemplate. This template
> sets up the overall look of our page. i.e. it create
context sensitive
> menus, titles, icons, style sheets, etc.... Then we
have individual
> pages with supplies the content. I can see where
caching this master
> template would be advantageous, as long as we could
render it with a new
> model on each request. For my particular use of
Barracuda, we are
> somewhat limited on memory usage, doing a lot of
in-memory caching would
> not be too good for me.
>
> Denny
>
> Franck Routier wrote:
> > [re-sent - didn't make it to the list ?]
> >
> > Hi all,
> >
> > I have a question regarding components reuse or
caching. After looking
> > at the code, I have the feeling that at the end of
the rendering phase,
> > destroyCycle() is called on every component. This
will null references
> > to children, views, ... So it seems to me that it
would be difficult to
> > cache / reuse components (in a servlet session,
for example for a part
> > of the UI like a toolbar).
> >
> > So here is my question :
> >
> > - does anyone cache components in his/her app (ie
reuse the same
> > instance of a component on several
request/response cycles) ?
> >
> > - does anyone remember if this is supposed to be
possible or not ? On
> > that matter, I have found a tread on the subject
here :
> > http://osdir.com/ml/java.enhydra.barracu
da.general/2002-11/msg00084.html
> > (but well, it was in 2002...)
> >
> > - is this desirable ? If not why ?
> >
> > - should the destroyCycle() be more more
conservative, ie destroy only
> > references to stepChildren (not regular children)
or tempViews (not
> > regular views) ? destroyCycle() is here to prevent
memory leaks, so I
> > would rather be conservative with it, but maybe it
could be enhanced to
> > promote components reuse...
> >
> > Any thought on this ?
> >
> > Franck
> >
> >
> >
> >
> >
------------------------------------------------------------
------------
> >
> >
> > --
> > Barracuda mailing list
> > Barracuda objectweb.org
> > http://www.objectweb.org/wws/lists/projects/barracuda
> >
>
> pièce jointe document plein texte
(message-footer.txt)
>
> --
>
> Barracuda mailing list
>
> Barracuda objectweb.org
>
> http://www.objectweb.org/wws/lists/projects/barracuda
>
|
|
|
[1-3]
|
|