Locking code with cflock
333
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.
Similarly, ColdFusion MX cannot automatically ensure that two sections of code do not attempt
to access external resources such as files, databases, or CFX tags that cannot properly handle
simultaneous requests. Nor can ColdFusion MX ensure that the order of access to these shared
resources is consistent and results in valid data.
By locking code that accesses such resources so that only one thread can access the resource at a
time, you ensure data integrity.
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
Содержание ColdFusion MX
Страница 1: ...Developing ColdFusion MX Applications...
Страница 22: ...22 Contents...
Страница 38: ......
Страница 52: ...52 Chapter 2 Elements of CFML...
Страница 162: ......
Страница 218: ...218 Chapter 10 Writing and Calling User Defined Functions...
Страница 250: ...250 Chapter 11 Building and Using ColdFusion Components...
Страница 264: ...264 Chapter 12 Building Custom CFXAPI Tags...
Страница 266: ......
Страница 314: ...314 Chapter 14 Handling Errors...
Страница 344: ...344 Chapter 15 Using Persistent Data and Locking...
Страница 349: ...About user security 349...
Страница 357: ...Security scenarios 357...
Страница 370: ...370 Chapter 16 Securing Applications...
Страница 388: ...388 Chapter 17 Developing Globalized Applications...
Страница 408: ...408 Chapter 18 Debugging and Troubleshooting Applications...
Страница 410: ......
Страница 426: ...426 Chapter 19 Introduction to Databases and SQL...
Страница 476: ...476 Chapter 22 Using Query of Queries...
Страница 534: ...534 Chapter 24 Building a Search Interface...
Страница 556: ...556 Chapter 25 Using Verity Search Expressions...
Страница 558: ......
Страница 582: ...582 Chapter 26 Retrieving and Formatting Data...
Страница 668: ......
Страница 734: ...734 Chapter 32 Using Web Services...
Страница 760: ...760 Chapter 33 Integrating J2EE and Java Elements in CFML Applications...
Страница 786: ...786 Chapter 34 Integrating COM and CORBA Objects in CFML Applications...
Страница 788: ......
Страница 806: ...806 Chapter 35 Sending and Receiving E Mail...