User Guide

Table Of Contents
360 Chapter 15: Using Persistent Data and Locking
Locking code with cflock
The cflock tag controls simultaneous access to ColdFusion code. The cflock tag lets you do the
following:
Protect sections of code that access and manipulate shared data in the Session, Application, and
Server scopes.
Ensure that file updates do not fail because files are open for writing by other applications or
ColdFusion tags.
Ensure that applications do not try to simultaneously access ColdFusion extension tags written
using the CFX API that are not thread-safe. This is particularly important for CFX tags that
use shared (global) data structures without protecting them from simultaneous access (not
thread-safe). However, Java CFX tags can also access shared resources that could become
inconsistent if the CFX tag access is not locked.
Ensure that applications do not try to simultaneously access databases that are not thread-safe.
(This is not necessary for most database systems.)
ColdFusion MX is a multithreaded web application server that can process multiple page requests
at a time. As a result, the server can attempt to access the same information or resources
simultaneously, as the result of two or more requests.
Although ColdFusion MX is thread-safe and does not try to modify a variable simultaneously,
it does not ensure the correct order of access to information. If multiple pages, or multiple
invocations of a page, attempt to write data simultaneously, or read and write it at the same time,
the resulting data can be inconsistent, as shown in the following “Sample locking scenarios
section.
Server.ColdFusion.ProductVersion The version number for the server that is running, such as
6,0,0.
Server.ColdFusion.Rootdir Directory under which ColdFusion is installed, such as
C:\cfusion.
Server.ColdFusion.SerialNumber The serial number assigned to this server installation.
Server.ColdFusion.SupportedLocales The locales, such as English (US) and Spanish (Standard),
supported by the server.
Server.OS.AdditionalInformation Additional information provided by the operating system,
such as the Service Pack number.
Server.OS.arch The processor architecture, such as x86 for Intel Pentium
processors.
Server.OS.BuildNumber The specific operating system build, such as 1381
Server.OS.Name The name of the operating system, such as Windows NT.
Server.OS.Version The version number of the operating system, such as 4.0.
Variable Description