> The objects I am copying from are persisted in the session 
> scope. I would like to be able to read from these objects at 
> runtime without having to lock them all over the place. Does 
> creating a pointer in the request scope to an object in 
> session absolve you from locking? I'm not sure, and to be 
> honest, I haven't found a lot of information either way on 
> the issue, so copying the object seems to be playing it safe, no?

No, creating a reference in the request scope to an object in the session
scope doesn't absolve you of responsibility for race conditions. But is
there really a possibility for a race condition here anyway? I sincerely
doubt it (although I would need to see source code to guarantee that).

What I can guarantee, though, is that "playing it safe" in this case may not
actually be a safe solution at all; locking imposes significant overhead, so
using it where it isn't necessary may prevent your application from scaling
as needed. As someone who spends a fair amount of my time reviewing others'
code, I've actually run across this many times; far more than I've
encountered race conditions.

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/

Fig Leaf Software provides the highest caliber vendor-authorized
instruction at our training centers in Washington DC, Atlanta,
Chicago, Baltimore, Northern Virginia, or on-site at your location.
Visit http://training.figleaf.com/ for more information!


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Get the answers you are looking for on the ColdFusion Labs
Forum direct from active programmers and developers.
http://www.adobe.com/cfusion/webforums/forum/categories.cfm?forumid-72&catid=648

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:292287
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to