You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Johannes Lichtenberger <Jo...@uni-konstanz.de> on 2009/12/11 02:09:07 UTC

Multithreading within a pipeline component.

Hello,

is it even possible to generate threads for instance in a generator? I
assume the SAX events generated wouldn't be in the right order at the
following transformer.

regards,
Johannes 


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


Re: Multithreading within a pipeline component.

Posted by Steven Dolg <st...@indoqa.com>.
Reinhard Pötz schrieb:
> Johannes Lichtenberger wrote:
>   
>> Hello,
>>
>> is it even possible to generate threads for instance in a generator? I
>> assume the SAX events generated wouldn't be in the right order at the
>> following transformer.
>>     
>
> yes, it's your responsibility to take care of the right order of events.
> You could consider using a SAXBuffer which stores all events created by
> the different threads and finally stream them in the correct order to
> the generator's content handler.
>
>   
As Reinhard mentions above it is technically possible.
As also mentioned above, you have to pay attention to certain things.
Ensuring the correct event order is only one.

You must make sure, that all your threads are finished by the time 
you're leaving the execute(..) method of your generator.
Failing to do so will result in all kinds of trouble, since callers will 
try to access the result before it is ready and your generator will 
trigger result prodcution after resources (streams etc) might have been 
closed.

So far we refrained from adding components that allow threading because 
of the things mentioned above (creating a large number of threads can be 
a problem in and of itself)
but if you feel that this is a good solution for your problem and you 
can address all the issues that might arise, go ahead.

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


Re: Multithreading within a pipeline component.

Posted by Reinhard Pötz <re...@apache.org>.
Johannes Lichtenberger wrote:
> Hello,
> 
> is it even possible to generate threads for instance in a generator? I
> assume the SAX events generated wouldn't be in the right order at the
> following transformer.

yes, it's your responsibility to take care of the right order of events.
You could consider using a SAXBuffer which stores all events created by
the different threads and finally stream them in the correct order to
the generator's content handler.

-- 
Reinhard Pötz                           Managing Director, {Indoqa} GmbH
                         http://www.indoqa.com/en/people/reinhard.poetz/

Member of the Apache Software Foundation
Apache Cocoon Committer, PMC member                  reinhard@apache.org
________________________________________________________________________

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