Putting ColdFusion to sleep

Here is a code snippet that makes the ColdFusion processing "sleep" for the specified number of milliseconds. This works on ColdFusion MX 6 and above, which can expose the Java language from within CFML.

<cfset thread = CreateObject("java", "java.lang.Thread")>
<cfset thread.sleep(3000)> <!--- About to sleep for 3 seconds... --->

ColdFusion 8 introduced a new sleep() function. The above code and the new function are explained in more detail in this ColdFusion Cookbook article.

Comments
BlogCFC was created by Raymond Camden. This blog is running version 5.9.002. Contact Blog Owner