|
From: Erwin V. <erw...@er...> - 2005-03-29 13:05:39
|
Mmm. So you're thinking about a custom mapper that (in the 'createSubFlowInputAttributes' method) takes a list of persons (ids) from the parent flow scope and instantiates an algorithm object, passing in those ids. Once that is done it puts the algorithm object in the subflow scope. As far as I can see the mapper would still be thread safe right -- everything happens in a method call with local variables? All mappers (and actions) should be stateless and there should be little need to make them statefull. Anyway, thinking about this popped the following into my mind: currently the flow keeps references to the mapper objects that are looked up at flow configuration (build) time. The same is also true for actions and other flows (i.e. for all flow services looked up via a FlowServiceLocator). This is actually different from my original implementation where you could control wheter or not an action or mapper was a singleton by using the "singleton" property in the application context and the mapper or action was looked up every time it was needed. This kind of prototype mapper or action wasn't really that usefull since you could only hold state for a very short time: one 'use' of the object in the flow (e.g. input & output mapping would be 2 uses, so you could not share state by making the mapper statefull). However, I'm thinking that if you could have a singleton action/mapper per flow execution, you could really make the action or mapper statefull. Not sure if that would be a good idea though....just brainstorming... Agreed that 'porting' the old article to the new system would be a good idea. When we approach Spring web flow 1.0 final I'll take care of that. Erwin Vervaet erw...@er... ----- Original Message ----- From: "Steven Devijver" <ste...@gm...> To: <spr...@li...> Sent: Tuesday, March 29, 2005 8:48 AM Subject: Re: [Springframework-developer] webflow: subflow behavior question > Erwin, Keith, > > Thanks for your feedback. Regarding thread-safety, there would indeed > be no concern if the model-mapper object would be instantiated on > every execution of a flow-state. Is this the case? Otherwise, the > model-mapper would have no way of knowing when to create an new > algorithm instance, which would contain state. > > Regarding the old webflow article, I find it more concise than the > current docs on Confluence, it provides an excellent overview of how > to get started with WebFlow and I feel it should not be discarded. > With a little bit of work this article could be kept up to date. > > Regarding this new article, it will probably be published in the next > couple of weeks. I'm discussing the creation of a wizard across > multiple pages and the reuse of a subflow, the disadvantages of > classic MVC for these scenarios (I'm talking based on personal > experience :) and the advantages offered by WebFlow. > > Steven > > On Mon, 28 Mar 2005 12:02:41 -0500, Keith Donald <ke...@in...> > wrote: >> As Erwin mentioned, there should be no concern of thread safety here. >> Just >> create a prototype instance that encapsulates the context you need an >> pass >> it to the spawned subflow. That'll be thread safe, as operations on flow >> executions are synchronized per session per request. >> >> "PersonSearchAlgorithm" will would be a callback to some kind of >> contextual, >> query, yes? Yea, to me it makes sense to parameterize the sub flow >> execution with an instance of an appropriate contextual implementation of >> that interface (e.g "all persons where manager != <x>, or all persons not >> already attending or excluded"), delegating down to the DAO layer to >> actually perform the data access. I like the notion of this better than >> passing in a snapshot array of persons to exclude. >> >> HTH! Just curious, what is the web flow article? When will it be >> published? >> >> Keith >> >> Keith Donald >> Interface21 - Spring Training, Consulting, and Support, "From the Source" >> http://www.springframework.com >> >> -----Original Message----- >> From: spr...@li... >> [mailto:spr...@li...] On Behalf >> Of >> Erwin Vervaet >> Sent: Monday, March 28, 2005 11:35 AM >> To: spr...@li... >> Subject: Re: [Springframework-developer] webflow: subflow behavior >> question >> >> Threading issues are limited in web flows since a flow execution is >> basically single threaded: i.e. the flow execution entry methods (start() >> and signalEvent()) are synchronized. (At least this is the behaviour in >> the >> new implementation in the sandbox.) >> >> Ofcourse you could also pass the list of ids to the Person subflow. In >> that >> case your "subflow signature" would be something like >> >> public Person PersonFlow(String action, Person[] personsToExclude) >> >> We're maintaining documentation related to the "new" Spring web flow >> system >> at >> http://opensource.atlassian.com/confluence/spring/display/WEBFLOW/Home. >> Keith Donald has been working on a new partical guide that you can find >> there. >> >> Regarding the "old" Ervacon Spring web flow: I will let it go to 1.0.0 >> and >> then provide a migration guide to the new Spring web flow system. Ervacon >> Spring web flow is still useful for those people that stick with Spring >> 1.1.x, but if you have 1.2 or later it's probably better to go with the >> new >> system. >> >> Erwin >> >> Erwin Vervaet >> erw...@er... >> ----- Original Message ----- >> From: "Steven Devijver" <ste...@gm...> >> To: <spr...@li...> >> Sent: Monday, March 28, 2005 5:51 PM >> Subject: Re: [Springframework-developer] webflow: subflow behavior >> question >> >> > Hi Erwin, >> > >> > Although this is just a silly example to highlight my question passing >> > behavior through the model does seem a bit awkward to me. Especially, >> > the behavior class would also contain state (unless the state is >> > passed separately in the model but then the Person flow would need to >> > pass the state to the behavior). This would make the design not >> > thread-safe. >> > >> > In this scenario I would prefer to pass a list of ID's of Persons that >> > cannot be shown in the Person flow and implement the behavior once. >> > I'm looking into this because I'm working on an article on webflow. >> > >> > btw, I found you article "Spring Web Flows: A Practical Guide" very >> > helpful. Are you planning to keep it up to date with the latest >> > changes to WebFlow (e.g. the changes to the action interface)? >> > >> > Thanks >> > >> > Steven >> > >> > >> > On Mon, 28 Mar 2005 17:11:32 +0200, Erwin Vervaet >> > <erw...@er...> wrote: >> >> The Manager and Meeting flow indeed have to put a SearchAlgorithm >> >> instance >> >> in flow scope, probably in an 'initFlow' action state or something >> >> like >> >> that, which could also take care of any type of flow data >> >> initialisation, >> >> e.g. pulling in reference data.. You then use an attribute mapper to >> >> pass >> >> the SearchAlgorithm to the subflow in the subflow state. >> >> >> >> Erwin Vervaet >> >> erw...@er... >> >> ----- Original Message ----- >> >> From: "Steven Devijver" <ste...@gm...> >> >> To: <spr...@li...> >> >> Sent: Monday, March 28, 2005 4:59 PM >> >> Subject: Re: [Springframework-developer] webflow: subflow behavior >> >> question >> >> >> >> > Hi Erwin, >> >> > >> >> > >> >> >> I would probably do this by making the search (or filter) algorithm >> >> >> configurable for the Person flow. That way the calling parent flow >> >> >> can >> >> >> pass >> >> >> in the algorithm to use. I find that a good way to think about a >> >> >> flow >> >> >> is >> >> >> as >> >> >> a method: it has input parameters and can return results. So your >> >> >> person >> >> >> flow would be something like this, when expressed as a method: >> >> >> >> >> >> public Person PersonFlow(String action, SearchAlgorithm algorithm) >> >> >> >> >> > Does this mean the Manager and Meeting flows have to put a >> >> > SearchAlgorithm instance in the session (or the model?) before >> >> > passing >> >> > control to the Person subflow? Does this require an action-state >> >> > before the flow-state in the Manager and Meeting flows? >> >> > >> >> > Thanks >> >> > >> >> > Steven >> >> > >> >> > >> >> > ------------------------------------------------------- >> >> > SF email is sponsored by - The IT Product Guide >> >> > Read honest & candid reviews on hundreds of IT Products from real >> >> > users. >> >> > Discover which products truly live up to the hype. Start reading >> >> > now. >> >> > http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click >> >> > _______________________________________________ >> >> > Springframework-developer mailing list >> >> > Spr...@li... >> >> > https://lists.sourceforge.net/lists/listinfo/springframework-developer >> >> > >> >> > >> >> >> >> ------------------------------------------------------- >> >> SF email is sponsored by - The IT Product Guide >> >> Read honest & candid reviews on hundreds of IT Products from real >> >> users. >> >> Discover which products truly live up to the hype. Start reading now. >> >> http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click >> >> _______________________________________________ >> >> Springframework-developer mailing list >> >> Spr...@li... >> >> https://lists.sourceforge.net/lists/listinfo/springframework-developer >> >> >> >> >> > >> > >> > -- >> > "If you want to be a different fish, you gotta jump out of the school." >> > -- Captain Beefheart >> > >> > >> > ------------------------------------------------------- >> > SF email is sponsored by - The IT Product Guide >> > Read honest & candid reviews on hundreds of IT Products from real >> > users. >> > Discover which products truly live up to the hype. Start reading now. >> > http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click >> > _______________________________________________ >> > Springframework-developer mailing list >> > Spr...@li... >> > https://lists.sourceforge.net/lists/listinfo/springframework-developer >> > >> > >> >> ------------------------------------------------------- >> SF email is sponsored by - The IT Product Guide >> Read honest & candid reviews on hundreds of IT Products from real users. >> Discover which products truly live up to the hype. Start reading now. >> http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click >> _______________________________________________ >> Springframework-developer mailing list >> Spr...@li... >> https://lists.sourceforge.net/lists/listinfo/springframework-developer >> >> ------------------------------------------------------- >> SF email is sponsored by - The IT Product Guide >> Read honest & candid reviews on hundreds of IT Products from real users. >> Discover which products truly live up to the hype. Start reading now. >> http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click >> _______________________________________________ >> Springframework-developer mailing list >> Spr...@li... >> https://lists.sourceforge.net/lists/listinfo/springframework-developer >> >> > > > -- > "If you want to be a different fish, you gotta jump out of the school." > -- Captain Beefheart > > > ------------------------------------------------------- > SF email is sponsored by - The IT Product Guide > Read honest & candid reviews on hundreds of IT Products from real users. > Discover which products truly live up to the hype. Start reading now. > http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click > _______________________________________________ > Springframework-developer mailing list > Spr...@li... > https://lists.sourceforge.net/lists/listinfo/springframework-developer > > |