Sylvain Wallez wrote:
Hi,
I'm playing and digging in flow-enabled petstore (BTW, so nice, I love it), and experienced some problems with the continutation-enabled prev/next navigation.
To reproduce it, go to the "dogs" area, click "next" once and then hit the browser's reload button. The prev and next links are now totally screwed.
Any ideas on what's going on ?
Yep. It's a bug. Here's a fix:
Thanks :)
Moreover, AFAIU, the "productList" variable in viewCategory() is stored in the continuation, and so if we hit "next" and then "prev", the first list exists twice (in different continuations). Isn't there a potential memory consumption problem ? I know continuations expire, but withing the expiration delay, all these lists keep floating around...
Yes, but the only things that are really duplicated are the program counter and stack frames, and even the stack itself is lazily copied. The local variables themselves (like productList) are shared between continuations.
What do you mean by "lazily copied" ? Doesn't it need to be actually copied to be stored ?
Also, how can local variables be shared between continuations if their value changes between calls to sendPageAndWait, as is the case of producList ? Isn't it contradictory with the continuation concept which should restore variable values ?
Sorry for these newbie questions. Is there any docs that explains all this ? If found your post about JavaScript for Java programmers but it doesn't give any details about this.
Also, how are handled global variables ? AFAIU calling createSession() "attaches" them to the session, but what if createSession() isn't called ?
And what is the relationship between global variables and continuations ?
That being said, it is still possible to explicitly free memory when a continuation is captured, using this extended JavaScript syntax:
<snip-example/>
Thanks for your explanations, Sylvain
-- Sylvain Wallez Anyware Technologies http://www.apache.org/~sylvain http://www.anyware-tech.com { XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects }