[opencms-dev] Question about instantiation/reuse of template classes

Michael Schmitt mi.schmitt at gmx.de
Thu Jun 12 13:10:02 CEST 2003


Hi,

I wrote several template classes. 
Some of them will be cached dependent on some parameters. 
Others should never be cached.
The caching mechanism works as I expected (several variants
have been created dependent on different parameters).
But for the templates that should not be cached, I am uncertain 
about the creation of new instances of my template class. It 
seems to me as if a new instance is created for every call (every
web-call of a page that uses the corresponding template).
But I would like to have that for every call the same instance will
be reused.
Is this somehow (cofiguration, programming) possible?

A second question (that is only relevant if no new instance will 
be created for every call) is about thread-safety of the template
classes.
Does OpenCms ensures that only one thread accesses the
getContent() method of the template classes?
Or do I have to take care for thread-safety on my own (for example,
through synchronisation of the getContent() method)?


Thanks in advance for every reply,
michael




More information about the opencms-dev mailing list