Christoph Gaffga wrote:
>
> hi,
> I had some difficulties making the ContentAggregator multithreaded. Now it
> works, but there are still some open questions. One in dealing with
> CocoonComponentManager, the other about the best design for the
> aggreagator.
>
> (1) synchronization in CocoonComponentManager
> ---------------------------------------------
> I always had null-pointer exceptions and index out of bound when
> processing
> multiple parts for the aggregator in parallel in different threads.
> It works when I declare the following methods in CocoonComponentManager as
> synchronized:
>   enterEnvironment,
>   leaveEnvironment,
>   startProcessing,
>   endProcessing,
>   addComponentForAutomaticRelease,
>   removeFromAutomaticRelease,
>   in EnvironmentDescription (same file) I also decleared
>     addtoAutorelease and
>     removeFromAutoRelease as synchronized
>
> But I think this is only a workaround, so Im not realy sure what has to be
> fixed to have a thread-safe implementation. I would apreciate any
> information about how to go on.
>
This is really strange, I will have a look at it in the next days. Yes,
synchronizing is only a workaround.

> (2) best practice for implementing aggregator
> ---------------------------------------------
> What would be the best practice for the implementation of the
> multithreaded
> ContentAggregator. I think there are to possibilities:
>
>  a. Make it using IncludeCacheManager, that's the way the
> CIncludeTransformer includes it's content, and it's the way my current
> implementation works.
>
>  b. Make it using SourceUtil.toSAX and MirrorRecorder. That would
> be a more
> lightwight implementation than using all the CacheManagerSession
> stuff. But
> it didn't work. With this way of implemeting it I had trouble with the
> ComponentManager again.
>
Yes, I think a) is the way to go.

> So, does anybody know what exactly the IncludeCacheManagerSession does? I
> could'n find something that seems to be so special, like creating a new
> Environment/ComponentManager. Does anybody know anything about it?
>
Yes, I know (ok, I developed it...): Now the object holds the configuration
for the current request. This is used by the IncludeCacheManager, a
ThreadSafe
component. The CacheManager queries the session object, if the includes
should
processed in parallel, how the content is cached, when it expires etc.
So, it's just a data object.
>
> How is the interest about having another implementation of
> ContentAggregator
> within cocoon? And, is there anybody who could help me to get the
> ComponentManager thread-safe?
>
Yes, I will try :)

> P.S. If anybody is interested in the code, I'll send it over if requested.
>
Yes, please.

Carsten

Reply via email to