Read up on race conditions, and using the cflock tag. Concurrent sessions tend to taint certain scopes if you don't know how to handle them correctly.
-----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Gavin Baumanis Sent: Friday, 24 April 2009 3:37 PM To: cfaussie Subject: [cfaussie] Re: Session / application scope management. Hi Mark (And everyone else), On Apr 17, 5:23 pm, Mark Mandel <[email protected]> wrote: > Some questions / points > > 1) Are you using Application.cfm, or Application.cfc? > I assume you are using Application.cfm, you will need to do some > locking of this, as you can definitely get 2 people hitting your > website at the same time, which can instantiate 2 copies of your > model. Not what you want. I would suggest moving to Application.cfc, > onApplicationStart() event, as this will manage this for you. > Correct I am using Application.cfm at the moment. I (previously) never saw the requirement to shift over to Applicaiton.cfc - so I ust stuck with what I have always done. (Looks like I'll go do some reading on Application.cfc!) > 2) When you say ' concurrent sessions are infecting each other's > records.', what does that mean? What information is being passed > across, and how is that information being managed? This is for a questionnaire. After every question the response is saved. So incomplete questionnaires are recorded for statistical analysis. Also, if you answer q1 twice it records both answers and shows that answer number 2 supercedes answer 1 If I open two browsers, (one IE - one FF) I start off using FF and answer three questions. I switch to the IE browser and start a new session / questionnaire. The questionnaire (in the DB) shows that the FF based questionnaire now has two answers for q1. The IE based session now has no questions as answered. > 3) Why are you pulling everything out of CS to push into your > application scope? The idea is to let CS manage it for you... you are > just giving yourself more work ever time you create something new. I > would just reference it directly from the beanFactory. That being > said, is there nothing in FuseBox that will autowire your controllers > for you, like you can in Mach-II, Model-Glue or ColdBox, so you don't > have to manage pulling objects out of CS directly? I am betting that it is because I was using CS incorrectly and not really understanding what it was doing for me. I now have; <cfif not isDefined("session.user.loggedin") OR session.user.getLoggedIn() EQ false> <cfset session.user = application.beanFactory.getBean ('userManager').login('test','test')> <cfset session.pages = application.beanFactory.getBean ('pageManager').getAllPages()> <cfset session.assessment = application.beanFactory.getBean ('assessmentManager').createAssessment(session.user.getId())> </cfif> And after reading through the last few posts about singletone and the CS defaults I have also amended the bean declarations to; <bean id="answers" class="itw.model.answer.answers" singleton="false" / > <bean id="questions" class="itw.model.question.questions" singleton="false" /> Does this all look correct now? Gavin. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "cfaussie" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cfaussie?hl=en -~----------~----~----~----~------~----~------~--~---
