204
Developing Web Applications with ColdFusion
dynamic value for the NAME attribute to allow protection of a file with any given
name.
<CFLOCK NAME=#FileName# TIMEOUT=60 TYPE="Exclusive">
<CFFILE ACTION="Append"
FILE=#FileName#
OUTPUT=#TextToAppend#>
</CFLOCK>
Example of protecting ColdFusion Extensions
This example illustrates how a custom tag wrapper can be built around CFXs that are
not thread-safe. The wrapper simply forwards attributes to the non thread-safe CFX
that is used inside a CFLOCK tag. An anonymous lock is used here because this is the
only place from which the CFX will be invoked.
<CFPARAM NAME="Attributes.AttributeOne" Default="">
<CFPARAM NAME="Attributes.AttributeTwo" Default="">
<CFPARAM NAME="Attributes.AttributeThree" Default="">
<CFLOCK TIMEOUT=10 TYPE="Exclusive">
<CFX_NOT_THREAD_SAFE AttributeOne=#Attributes.AttributeOne#
AttributeTwo=#Attributes.AttributeTwo#
AttributeThree=#Attributes.AttributeThree#>
</CFLOCK>
Note
This example assumes that this is the only instance this CFX is used in the
application. To lock a non-thread safe CFX that used multiple times in an
application, used named locking rather than anonymous locking,
specifying the same name for each lock.
For more information
See the CFML Language Reference for more information on using CFLOCK.
Содержание COLDFUSION 4.5-DEVELOPING WEB
Страница 1: ...Allaire Corporation Developing Web Applications with ColdFusion ColdFusion 4 5...
Страница 14: ...xiv Developing Web Applications with ColdFusion...
Страница 26: ...xxvi Developing Web Applications with ColdFusion...
Страница 34: ...8 Developing Web Applications with ColdFusion...
Страница 70: ...44 Developing Web Applications with ColdFusion...
Страница 84: ...58 Developing Web Applications with ColdFusion...
Страница 114: ...88 Developing Web Applications with ColdFusion...
Страница 148: ...122 Developing Web Applications with ColdFusion...
Страница 174: ...148 Developing Web Applications with ColdFusion...
Страница 208: ...182 Developing Web Applications with ColdFusion...
Страница 244: ...218 Developing Web Applications with ColdFusion...
Страница 274: ...248 Developing Web Applications with ColdFusion...
Страница 288: ...262 Developing Web Applications with ColdFusion...
Страница 300: ...274 Developing Web Applications with ColdFusion...
Страница 350: ...324 Developing Web Applications with ColdFusion...
Страница 362: ...336 Developing Web Applications with ColdFusion...