cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Fagerstrom <dani...@nada.kth.se>
Subject Problems with lazy loading components
Date Mon, 17 Oct 2005 08:22:19 GMT
While working on the block architecture yesterday, I saw that most of 
the test cases 
(org.apache.cocoon.test.components.blocks.BlocksManagerTestCase) failed. 
The problem was that block local files where resolved in wrong context. 
After having controlled that nothing in the source resolution mechanism 
had changed since last time I run the tests, I started to suspect the 
lazy loading of components. After having switch to eager loading 
everything worked again.

What happens is the following: The CocoonSourceResolver resolves 
relative the current processor (via 
EnvironmentHelper.getCurrentProcessor()) if there is a current processor 
and otherwise relative the context root from the Avalon context. So, 
during eager loading of global components there is not yet a current 
processor, so the source reolution within the components will be 
relative the root context of the component manager of the component. 
This is the correct behaviour.

During lazy loading the source resolution in the component will be 
relative the context of the processor that it happen to be first used 
in. This is in general wrong and can be rather confusing and complicated 
to find what went wrong.

I think the main problem is that we have a global source resolver and 
try to get the context right during resolution in a smart and subtle 
(and fragile) way. If we instead create one source reolver within each 
service manager all source resolution within a specific service manager 
will be relative to the context of the service manager irrespectible of 
when the resolution is done, whether it is eager or lazy. It will also 
simplify the architecture, and maybe we could get rid of the source 
resolver from the Processor interface.

Anyway, I suggest that we turn of lazy loading until we have solved this 
issue.

WDYT?

/Daniel


Mime
View raw message