Make ColdFusion Sleep
I've been in java training now for 6 weeks, and I have been adding "java" code to Coldfusion. For example, I added a new "Exception" to coldfusion to allow my code to throw an error that has multiple message in that error. This is great for server side Validation !!! Where my code checks all the validation rules and adds the errors to the Exception code, and at the end of the method if there is one error, it does a cfthrow with that java Exception object. More details on java ValidationException here...
But I wanted to test the "thread" safe of this java code within coldFusion, since I am not sure how CF has there Code written. So to do this, i had a page store the Exception in memory and use it from two pages. But I wanted the 1st page to start first and end last, and the 2nd page to start last and end first. HMMM how can i do that. Well, I added a SLEEP routine to the pages. Of course, I didn't know how to do this, so I found this bit of code from Duncan Loxton's Blog.
But I wanted to test the "thread" safe of this java code within coldFusion, since I am not sure how CF has there Code written. So to do this, i had a page store the Exception in memory and use it from two pages. But I wanted the 1st page to start first and end last, and the 2nd page to start last and end first. HMMM how can i do that. Well, I added a SLEEP routine to the pages. Of course, I didn't know how to do this, so I found this bit of code from Duncan Loxton's Blog.
<cfset thread = CreateObject("java", "java.lang.Thread")>
<cfset thread.sleep(5000)>
<cfset thread.sleep(5000)>
Comments
Post a Comment