You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Christoph Gaffga <cg...@triplemind.com> on 2003/05/23 00:59:57 UTC

ContentAggregator and multithreating (migrating C2 -> C2.1M2), is it thread-safe?

Hi,

we are mirgating form cocoon2.0.4 to cocoon2.1-M2 and found some Problems
with the new APIs. We rewrote the ContentAggregator to use Threads an
simulaniosly generate the parts, buffer them, and then write the output in
the right order.
With cocoon2.1-M2 there seems to be some syncronization issue, we always get
the following exception:

java.lang.IndexOutOfBoundsException: Index: 55, Size: 31
        at java.util.ArrayList.RangeCheck(ArrayList.java:508)
        at java.util.ArrayList.remove(ArrayList.java:388)
        at
org.apache.cocoon.components.EnvironmentDescription.removeFromAutoRelease(Co
coonComponentManager.java:569)
        at
org.apache.cocoon.components.CocoonComponentManager.removeFromAutomaticRelea
se(CocoonComponentManager.java:410)
        at
org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.release(Abs
tractProcessingPipeline.java:203)
        at
org.apache.cocoon.components.source.impl.SitemapSource.reset(SitemapSource.j
ava:436)
        at
org.apache.cocoon.components.source.impl.SitemapSource.toSAX(SitemapSource.j
ava:428)
        at
org.apache.cocoon.components.source.SourceUtil.toSAX(SourceUtil.java:159)
        at
org.apache.cocoon.components.source.SourceUtil.toSAX(SourceUtil.java:126)
        at
com.triplemind.asp.generator.AbstractAggregator$Part.run(AbstractAggregator.
java:96)

The Aggregators generate() method looks like that:

  public void generate() throws IOException, SAXException,
ProcessingException {
    ...
      // Start generation...
      for(int i = 0; i < this.parts.size(); i++) {
        final Part part = (Part)this.parts.get(i);
        part.start();
      }
      // Start aggregation...
      for(int i = 0; i < this.parts.size(); i++) {
        ...
          part.join();
          part.toSAX(this);
        ...
      }
    ...
  }

as said before, the part caches the result of the source. When we have the
same in one for-loop, than ist runs fine, so it't not a problem with our
class, I guess. In cocoon2.0.4 it runs as well.

So, is there a known Problem with thread-safty? How to solve this?

Regards
Christoph Gaffga
cgaffga@triplemind.com


P.S.: Wouldn't it be nice to have a multi-threaded Aggreagator with cocoon?




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


Re: ContentAggregator and multithreating (migrating C2 -> C2.1M2), is it thread-safe?

Posted by Torsten Knodt <to...@datas-world.de>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Christoph,
> We rewrote the ContentAggregator to use Threads an
> simulaniosly generate the parts, buffer them, and then write the output in
> the right order.
Hope it will go into cocoon.

> With cocoon2.1-M2 there seems to be some syncronization issue, we always
> get the following exception:
Perhaps you should move this to cocoon-dev. It's more developing than using. I 
think there are many developers which will gladfully help with this. Oh yes. 
Making a patch avalaible (including a very simple test case which fails), 
would be of great help for helping. ;)

> P.S.: Wouldn't it be nice to have a multi-threaded Aggreagator with cocoon?
Nice? It would be fantastic. I think this issue is on the top two of the 
performance killers in cocoon.

- -- 
Domain in provider transition, hope for smoothness. Planed date is 24.7.2003
pub 1024D/4CD29A2C 2001-01-12 Torsten Knodt <to...@datas-world.de>
 Schl.-Fingerabdruck = A2B1 C626 F819 7C58 B2F9 4F4C BF16 64B6 4CD2 9A2C
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)

iD8DBQE+zebEvxZktkzSmiwRAj++AJwIMfyPevWYghDK9vunASun0LIolQCfXZTv
8QdQeMHondq2Hw5k2mHX8p4=
=zpbF
-----END PGP SIGNATURE-----


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