Macromedia coldfusion 4.5-cfml language reference User Manual

Page of 608
Chapter 1:  ColdFusion Tags
123
THROWONTIMEOUT
Optional. Yes or No. Specifies how timeout conditions should be handled. If the 
value is Yes an exception will be generated to provide notification of the timeout. If 
the value is No execution continues past the </CFLOCK> tag. Default is Yes.
TYPE
Optional. ReadOnly or Exclusive. Specifies the type of lock: read-only or exclusive. 
Default is Exclusive. A read-only lock allows more than one request to read shared 
data. An exclusive lock allows only one request to read or write to shared data. See 
the following Note.
Note
Limit the scope of code that updates shared data. Exclusive locks are 
required to ensure the integrity of these updates, but they have a 
significant impact on performance. Read-only locks are faster. If you 
have a performance-sensitive application, you should substitute read-
only locks for exclusive locks wherever it is possible, for example, when 
reading shared data.
Usage
ColdFusion Server is a multi-threaded web application server that can process 
multiple page requests at any given time. Use CFLOCK to guarantee that multiple 
concurrently executing requests do not manipulate shared data structures, files, or 
CFXs in an inconsistent manner. Note the following:
Using CFLOCK around CFML constructs that modify shared data ensures that 
the modifications occur one after the other and not all at the same time. 
Using CFLOCK around file manipulation constructs can guarantee that file 
updates do not fail due to files being open for writing by other applications or 
ColdFusion tags.
Using CFLOCK around CFX invocations can guarantee that CFXs that are not 
implemented in a thread-safe manner can be safely invoked by ColdFusion. 
This usually only applies to CFXs developed in C++ using the CFAPI. Any C++ 
CFX that maintains and manipulates shared (global) data structures will have to 
be made thread-safe to safely work with ColdFusion. However, writing thread-
safe C++ CFXs requires advanced knowledge. A CFML custom tag wrapper can 
be used around the CFX to make its invocation thread-safe.
Scope
Whenever you display, set, or update variables, in one of the shared scopes, use the 
SCOPE attribute to identify the scope as Server, Application or Session.
Within the ColdFusion Administrator, the Locking page, under the Server section, 
allows you to set different characteristics of the locking schema according to scope.The