|
Ever needed to make a template 'sleep' for a defined period? |
One of the code snippets I've had scattered around is a short java command to make the current thread sleep, for a set period.
Its handy if you want to add a set period of delay to an application, for any reason.
2
3thread = createObject("java", "java.lang.Thread");
4thread.sleep(javaCast("long", 5000));
5
6</cfscript>
It creates the java thread object, and uses the sleep method to pause the thread for whatever numeric value you give it. In this example 5000ms.
There are no comments for this entry.
[Add Comment] [Subscribe to Comments]