Hello all,
 
I work with Cocoon release 2.1.11.
I got a working test XSP with 4 includes.
The include transformer is defined to process inclusions in parallel.
 
It works fine when i reference the inclusions through the sitemap via "cocoon:/" URIs, I can see 4 threads processing the inclusions in parallel.
When I switch this to external URLs (via "http://"), everything works, but inclusions are now serially processed.
 
I digged and stepped into the Cocoon source and I can see that the problem is located in the org.apache.cocoon.transformation.IncludeTransformer line 563 (Cocoon 2.1.11) :
 
synchronized (validity) {
    validity.addSource(source);
}

Each "external" inclusion after the first one is waiting for synch on the addSource method call.

When working with sitemap inclusions (cocoon://), the source.getValidity() performed by the validity.addSource(...) method returns immediately without really generating the element. There is no synchronization issue here. The generation is done outside of this synchronized block.

When working with external URL inclusions (http://), the source.getValidity(...) effectively PERFORMS the remote call and waits for the element to be generated, thus creating synchronization issues preventing the use of parallel inclusion of external URL. Each inclusion will wait on the synchronize until the previous external call returns.

I am working on ways to overload the MutliSourceValidity class to avoid making the getValidity call under specific circumstances.

Some questions now :

- Is it a bug ?

- Is there any workaround for this ?

- Is it safe to extend the MutliSourceValidity class to avoid performing the remote call in the addSource method ?

 

Thank you very much for your time. I would be glad to give you some details, should you need to.

Christophe.