
23
DEVELOPING
COLDFUSION 9 APPLICATIONS
The CFML Programming Language
Las
t
upda
te
d 8/5/2010
THREAD name="text" [action="run"] [priority="priorityValue"
application-specific attributes] {
thread code
}
The code in the thread operation body executes in a single ColdFusion thread. Code outside the body is not part of the
thread. You can use the following methods to manage the thread:
•
threadTerminate(threadName)
This function terminates the thread specified by the threadName parameter. It behaves in the same way as cfthread
action="terminate".
•
threadJoin([[threadName], timeout])
This function joins the current thread with the specified thread or threads. The current thread waits until either the
specified threads complete, or the timeout period passes, whichever happens first. The current thread inside a
thread function block belongs to that block thread and the current thread outside a thread function block is the page
thread.The threadName parameter is a comma-delimited list specifying one or more threads to join with the page
thread. If you omit this attribute, the current thread waits until all ColdFusion threads finish running.The timeout
parameter specifies the maximum time, in milliseconds, the calling thread waits for the other threads to complete
processing. If one or more threads do not complete before the time out period, the current thread processing begins
immediately. If you omit this attribute, the current thread waits until all specified threads finish running.
Note:
You can also use these functions with transactions that you create by using cftransaction tags.
Service tags with bodies
ColdFusion provides objects, implemented as CFCs, that correspond to the following service tags:
•
cfftp
•
cfhttp
•
cfmail
•
cfpdf
•
cfquery
•
cfstoredproc
These tags have bodies and provide services such as executing queries or sending mail. Many of them have action
attributes, whereas others have an implicit action, such as execute. For each service tag, except for
cfmail
and
cfpdf
, a
component is returned with applicable properties set and you need to invoke getters on the properties to access the data.
Note:
Previously, invoking getName() and getResult() methods returned data like query resultset, pdf object, or ftp prefix,
but now this has been changed and instead a component is returned with appropriate properties set.
The object names are the tag names without the cf prefix, for example, ftp. These objects also support child tag
functionality, such as cfmailpart and cfmailparam.
Note:
There may be thread-safety issues if implicit setters are used and child tags such as
cfmailpart
or
cfmailparam
are added because they get added into the CFC variable scope. It is therefore recommended that you create a new
component for each service. If you need to preserve the attribute state, use duplicate() on the component to retain any
initialized attribute values.
To use these tags in functions you:
1
Instantiate a service object.
2
Set object attributes and child tags
Содержание COLDFUSION 9
Страница 1: ...Developing Applications ADOBE COLDFUSION 9...