The following is a great analogy that was previously posted by Peter
Theobald 

"Alot of people are making this incorrect assumption.
Let me give an analogy that should make it easier to remember:

Cold Fusion's Advisory Locking, or "Shotguns in a dark room"
----------------------------------------------------------------------------
---

Imagine a big dark room. It is so dark that you cannot see anything in it at
all.
Your resource, an important bit of information, is in the room.

When you want to read the information, you hand a "Do Not Disturb" sign on
the door 
handle and go in to feel around and get a copy of the information.  It did
not take 
you very long to hang up the "Do Not Disturb" sign so your read was not
delayed very 
much by "read locking".

When you want to write the information you load the information up into your
trusty 
shotgun (along with a few rounds of buckshot), open the door to the dark
room and 
start blasting away. However, if there is a "Do Not Disturb" sign on the
door OF 
COURSE you cannot start shooting because there is someone in the room. You,
as writer, 
will have to wait until the "Do Not Disturb" sign is taken off the door. If
there are 
multiple "Do Not Disturb" signs on the door you will have to wait until
everyone comes 
out of the room and takes their "Do Not Disturb" signs. Your write is
potentially 
delayed by "write locking" or "exclusive locking".

Now imaging someone wants to read the information. They just need to get it
really 
quickly and don't bother to hang a "Do Not Disturb" sign because they are
only reading 
the information and will be really quick anyway.
Chances are no one will come by with a shotgun, and if they do they will
take a while 
to load it up. But if you take this chance sooner or later someone's gonna
get shot!"

-----Original Message-----
From: Fuon See Tu [mailto:[EMAIL PROTECTED]]
Sent: Monday, August 06, 2001 4:40 PM
To: CF-Talk
Subject: I dont understand session locking :(


i know why, but i dont know why!  Why won't CF just lock it all the time 
automatically who would want shared data with sessions when they can already

use an application variable for that.  Also I dont understand nested 
lockings and how it works.  All I usually end up doing is putting a Session 
lock around every session variable I see.  or if the session is used in a 
CFIF tag, i put the lock around that CFIF tag (not the closing CFIF tag).  
Or if there are a bunch of session variavles being read/written to, i put a 
session lock over them.  heck, why not just surround the whole page with one

session lock?  can someone help me grasp the concept of a session lock 
please?

:)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to