In the adobe coldfusion 10 documentation, on page: http://help.adobe.com/en_US/ColdFusion/10.0/Developing/WSc3ff6d0ea7785 9461172e0811cbec22c24-7d39.html#WSc3ff6d0ea77859461172e0811cbec0b63c-7 ff1
this page can be found by going to: www.adobe.com
" Home / Developing ColdFusion 10 Applications / Developing CFML Applications / Designing and Optimizing a ColdFusion Application " Defining the application and its event handlers in Application.cfc
ON this page, there is an example application.cfc After looking at the code, I am wondering if there is a typo/bug in the following code:
Should it be:
(A) cflock ... scope="SESSION" or
(B) cflock ... scope="APPLICATION" ?
If it is (A). then I am confused, can someone explain why?
Don't be confused... it's an error in the docs. You could do Adobe a favour by commenting at the bottom of the page: they do monitor those comments (they don't always react, but the do monitor them).
onSessionStart() is intrinsically single-threaded as far as the session scope goes: it's only ever run once per session (when the session starts...).
On the other hand the code in question def wants to single-thread access to that application-scoped variable as we don't want two simultaneous sessions hitting it for any given single value of it (if that makes sense).
It should be (B). The documentation says this elsewhere.
To see this, click on your own link above. Scroll to the table in the section "Using application event handlers". Click on the link OnSessionStart. You will see the same sample code, this time with session="application".
That is what I thought. but I wanted to confirm it was truely a bug before putting it on the page. Thank You for confirming that it should be "Application"
I saw this thread earlier and went ahead and added a note to that doc page on behalf of email@example.com and crediting Adam and BKBK. And I added a link back to this thread. Didn't want it to get missed, so thought I'd help there.