Adobe 38043740 - ColdFusion Standard - Mac Development Manual page 342

Developing applications
Hide thumbs Also See for 38043740 - ColdFusion Standard - Mac:
Table of Contents

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
Developing CFML Applications
2
Handle the error outside the thread by using the thread error information that is available to the page and other
threads in the Thread scope threadName
information. For example, after you join to a thread that had an error, you could check the threadname
variable for a value of
terminated
the threadName
variable for information on the termination cause.
.Error
Handling database transactions
Database transactions cannot span threads. For example, consider a page with the following structure:
<cftransaction>
<cfthread name ="t1" ...>
<cfquery name="q1" ...>
...
</cfquery>
</cfthread>
<cfquery name="q2" ...>
...
</cfquery>
<cfthread action="join" name="t1" ... />
</cftransaction>
In this case, query
is not included in the transaction that contains query
q1
transaction, you must place the complete transaction in a single thread, using a structure such as the following:
<cfthread name ="t1" ...>
<cftransaction>
<cfquery name="q1" ...>
...
</cfquery>
<cfquery name="q2" ...>
...
</cfquery>
</cftransaction>
</cfthread>
<cfthread action="join" name="t1" ... />
Using ColdFusion tools to control thread use
The Tag Limit Settings section of the ColdFusion Administrator Server Settings > Request Tuning page lets you specify
a maximum number of
cfthread
it queues additional
cfthread
Example: getting multiple RSS feeds
The following example uses three threads to get the results of three RSS feeds. The user must submit the form with all
three feeds specified. The application joins the threads with a time-out of 6 seconds, and displays the feed titles and the
individual item titles as links.
variable. Application code can check this variable for error
.Error
, which indicates that the thread terminated abnormally. You could then check
-started threads that can run at one time. When ColdFusion reaches this maximum,
requests and starts the queued threads when running threads end.
Last updated 1/20/2012
. To include both queries in the
q2
337
.status

Advertisement

Table of Contents
loading

This manual is also suitable for:

Coldfusion 9

Table of Contents