Stephan Coboos wrote:

Stephan Michels wrote:

member variables have the scope of the seesion.


Ok. But makes this sense? If I have no continuation I need no member variable.
Isn't it better to remove the member vars from the session scope and bind them on the contonuation object?
What's the reason to bind member vars to session and not to continuation?


This is the exact same behavior as global variables in FlowScript.

Continuations hold only the call stack (including parameters) and local variables. Class members belong to a "global" scope that is independent of continuations.

Considering that most often the need is to store user-related values (e.g. username, shopping cart, etc), that "global" scope is bound to the session, thus avoiding the use of session attributes.

There are some cases, however, where having a class member whose value depends on the continuation is useful, e.g. to avoid passing too many parameters around between methods. For this, FlowScript has PageLocal variables, which are similar to continuations to what InheritableThreadLocal are to threads. But AFAIK, this currently doesn't exist for JavaFlow.

Sylvain

--
Sylvain Wallez                                  Anyware Technologies
http://www.apache.org/~sylvain           http://www.anyware-tech.com
{ XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects }



Reply via email to