A way to make Thread Sleep in Apex

Sometimes we need make apex thread to sleep for a while, sush as testing if the soql with [For Update] works,and as we know the sfdc do not offer a method to sleep the thread.
Then I thought it may work if I use the “while”, like the following code.

Well, it looks not bad. : )


But anyway we have to pay special attention to the “Apex Governor Limits.

Reference: Script Limits, Begone!

Post Tagged with , , , ,