MACROMEDIA COLDFUSION 5-DEVELOPING Develop Manual page 261

Table of Contents

Advertisement

Examples of cflock
Example of synchronizing access to a file system
The following example shows how to use
system. The
file already open for writing by the same tag executing on another request.
Note that if an append operation takes more that 30 seconds, a request waiting to
obtain an exclusive lock to this code might time out. Also, note the use of a dynamic
value for the
result, locking access to one file does not delay access to any other file.
<cflock name=#filename# timeout=30 type="Exclusive">
</cflock>
Example of protecting ColdFusion Extensions
The following example illustrates how you can build a custom tag wrapper around a
CFX tag that is not thread-safe. The wrapper forwards attributes to the
non-thread-safe CFX tag that is used inside a
<cfparam name="Attributes.AttributeOne" default="">
<cfparam name="Attributes.AttributeTwo" default="">
<cfparam name="Attributes.AttributeThree" default="">
<cflock timeout=5
</cflock>
tag protects a
cflock
attribute so that a different locks controls access to each file. As a
name
<cffile action="Append"
file=#fileName#
output=#textToAppend#>
type="Exclusive"
name="cfx_not_thread_safe">
<cfx_not_thread_safe attributeone=#attributes.attributeone#
attributetwo=#attributes.attributetwo#
attributethree=#attributes.attributethree#>
to synchronize access to a file
cflock
tag from attempting to append data to a
cffile
tag.
cflock
241

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the COLDFUSION 5-DEVELOPING and is the answer not in the manual?

Questions and answers

Subscribe to Our Youtube Channel

This manual is also suitable for:

Coldfusion 5

Table of Contents