commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rahul Akolkar <>
Subject Re: [scxml] src and parser invocation
Date Thu, 03 Jun 2010 02:46:30 GMT
On Wed, Jun 2, 2010 at 8:39 PM, Fabrizio Morbini <> wrote:
> Hi Rahul, (btw, thanks for your quick and precise answers.)
> is there anything wrong in modifying the methog:
> DigestSrcAttributeRule in to add an
> HashMap<String,SCXML> that stores the result of the call
> "externalSrcDigester.parse(location);" for a given "location"?
> If the same "location" is encountered again, the previous result is reused.

That assumes the resource at the URL is a static one, whereas there is
no such limitation so it isn't cached by default. Obviously, if all
src'ed URLs are static in your case, that would certainly help to not
retrieve and parse them multiple times as you indicate above.

> i tried this and it works fine (no parse errors) and reduces the parse
> time from 90 seconds to less than a second. But i didn't try to
> execute the network and i'm afraid the produced network may have some
> subtle problems caused by reusing the result of the parser.

You may want to try executing it. There generally shouldn't be issues
unless you are src'ing in the same state (or entire state machine)
from the same external document multiple times in which case you can
run into ID clashes. There is a wiki page [1] that describes one
pattern to work around such clashes, but it involves dynamic resources
(so caching won't be a good option there).



> thanks,
> fabrizio.
> On Wed, Jun 2, 2010 at 17:18, Rahul Akolkar <> wrote:
>> On Wed, Jun 2, 2010 at 8:08 PM, Fabrizio Morbini <> wrote:
>>> Hi, if we have the following case:
>>>  2 scxml files: a.scxml and b.scxml
>>>  in a.scxml, 2 different nodes use the src attribute to source the
>>> content from other 2 different nodes defined in b.scxml (using the
>>> syntax src="b.scxml#node_i").
>>> is the file b.scxml completely parsed for every instance of src
>>> attribute found while parsing a.scxml? Or is b.scxml parsed only once
>>> and the result reused?
>> <snip/>
>> It will be parsed twice, completely (any time the src attribute is
>> used, the entire document at the mentioned URL is parsed). Therefore,
>> where possible, its better to separate content that gets sourced in,
>> into smaller independent files.
>> -Rahul
>>> thanks,
>>> fabrizio.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message