Back in the day, (before CFMX) you had to lock all accesses to application scope or risk crashing the server. So to cut down on the number of locks you copied the stuff in application scope to request scope at the beginning of each request. The code you have is just someone bringing a familiar but no longer needed practice with them when they they moved to mx. As of MX7 you would instantiate utilities like this in the onApplication start method of Application.cfc and not need the locks or the isDefineds. (Btw, I'm working with both MX7 and 6.1 but right now I'm focusing on 7)
Ok, so the second lock (the one setting the request variable) is not needed. Hm.. does onApplicationStart really eliminate the need for double locking, especially with singletons? From what I've read, onApplicationStart only locks the application scope when ColdFusion runs the method. If you call the method manually then the application scope isn't locked. Without locking couldn't you still end up inadvertently creating multiple instances in memory like Nando was saying? Or am I way off base ... :) --------------------------------- It's here! Your new message! Get new email alerts with the free Yahoo! Toolbar. You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/[email protected]
