cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vadim Gritsenko <>
Subject Re: Nasty flowscript issue - nailed
Date Tue, 06 Jul 2004 16:45:11 GMT
Sylvain Wallez wrote:

> Vadim Gritsenko wrote:
>> Sylvain Wallez wrote:
>>> JavaScriptInterpreter should have an id attribute intialized once, 
>>> whose value is used instead of getSitemapPath(), e.g.
>>>    private String interpreterID = IDGenerator.getNewID();
>> System.identityHashCode(this) is much simpler than suggested before 
>> IDgenerator.
> Mmmh... The javadoc states that uniqueness cannot be guaranteed, 
> although most JVMs implement it by returning the object pointer. 
> That's why using an ID generator looks safer to me.
> Thinking further, we actually don't need a time-based ID (I 
> copy/pasted this from some code I have here): a simple counter is 
> enough to do the job.

Exactly :-)

>> But, it was mentioned that some component is single threaded - this 
>> means, for second (parallel) request, another component will get 
>> created, with different ID - and different scope will be obtained, 
>> breaking the flow again.
> The interpreter is looked up by the sitemap engine (see 
>, so in that case SingleThreaded means a different 
> instance for each sitemap, which handles all requests for that sitemap.
> A bit hacky, but that's how it is since the origin to ensure proper 
> isolation of flowscripts between different sitemaps.
> So the unique ID attached to an interpreter instance is therefore also 
> unique per sitemap, which is what we want to achieve here.

Got you. Hope it's mentioned somewhere in the comments / javadocs :-)


View raw message