Locking Variables - MACROMEDIA COLDFUSION 4.5-ADMINISTRING COLDFUSION SERVER Manual

Table of Contents

Advertisement

Chapter 3: Configuring ColdFusion Server
To configure the Performance Monitor:
1.
From the Windows Start menu, select Programs > Administrative Tools >
Performance Monitor.
2.
In the Performance Monitor, select Edit > Add to Chart or File > Open to open an
existing chart.
In the Add to Chart dialog, select ColdFusion Server from the Object drop-down
list. You can change any of the display options (Color, Scale, Width, Style) for a
counter before adding it.
3.
Click one or more selections in the Counters list, then click the Add button. The
counters are listed at the bottom of the Chart View.
4.
Click the Explain button to display embedded help for the selected counter.

Locking Variables

Data stored in Server, Application and Session scopes ("shared data scopes") is
persistent across browser requests and multiple requests can access the data.
Unlocked access to data by multiple requests at the same time can corrupt the data.
While you can still use the CFLOCK tag introduced in ColdFusion 4.0 to control
simultaneous access to shared data in these scopes, ColdFusion 4.5 provides more
automatic means to protect shared data from incorrect access.
For each of the Server, Application and Session scopes, the Variable Locking
Administrator page provides three choices for control - none, full checking, and
automatic locking of read accesses:
Choosing "None" retains current ColdFusion behavior. All reads and writes of
data must be protected by a CFLOCK tag. No automatic protection is provided
and unprotected accesses may cause corruption of data.
Choosing "Full checking" will cause ColdFusion to raise an error if any read or
write of data in one of the scopes occurs outside of the scope of a CFLOCK. This
includes accesses to any data that is aliased by being assigned to a variable
outside of the shared data scopes and the data is not copied; this can occur for
struct and query variables. For example:
Choosing "Automatic read locking" will cause ColdFusion to raise errors for
unprotected writes, but unprotected reads will be automatically locked.
For Session scope, you can also choose to single thread session requests. This
means that all requests from the same session will occur sequentially, each
request waiting for all previous requests to finish before proceeding, preventing
multiple requests from simultaneously accessing shared data.
<CFLOCK type="EXCLUSIVE" scope="Session" timeout="10">
<CFSet Session.var = StructNew() >
<CFSet myvar = Session.myvar>
</CFLOCK>
<CFSet myvar2 = myvar>
<!--- unprotected access to alias --->
53

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the COLDFUSION 4.5-ADMINISTRING COLDFUSION SERVER and is the answer not in the manual?

Subscribe to Our Youtube Channel

This manual is also suitable for:

Coldfusion 4.5

Table of Contents