cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sylvain Wallez <>
Subject Re: Why is FlowInterpreter SingleThreaded?
Date Mon, 20 Oct 2003 15:26:25 GMT
Carsten Ziegeler wrote:

>Christopher Oliver wrote:
>>I think "SingleThreaded" is rather misleading in this case.  I know 
>>nothing about Avalon but from my experience it appears one flow 
>>interpreter is created per sitemap. However, this instance is definitely 
>>accessed by many threads concurrently. I had to put my own 
>>synchronization code into FOM_JavaScriptInterpereter to handle this.
>Yes, each sitemap holds a reference to the interpreter. As the sitemaps
>are ThreadSafe (one single instance per sitemap), this is true
>for the actual use of the interpreter as well.
>Now, if I understand you correctly, the interpreter can handle multiple
>requests at the same time? So, if this is true, it's ThreadSafe
>and we should change it.

After looking carefully, the interpreter must be SingleThreaded, even if 
thread safe...

This is because although an intepreter can handle concurrent requests, 
each sitemap must have a different instance, since the interpreter holds 
the scripts defined in a <map:flow> statement.

So if the interpreter is made ThreadSafe, a unique instance will exist 
for the whole system, and will mix all script definitions and script 
global variables. Making it SingleThreaded ensures each sitemap will 
have its own instance. It seems hacky, but I don't see what other means 
we have to achieve this...


Sylvain Wallez                                  Anyware Technologies 
{ XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects }
Orixo, the opensource XML business alliance  -

View raw message