Created
April 5, 2019 06:44
-
-
Save SalesforceBobLightning/d38bd32614df6ce445c8881f128e332a to your computer and use it in GitHub Desktop.
Thread sleep helper method for Salesforce Apex
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Thread { | |
public static void sleep(integer milliseconds) | |
{ | |
Long timeDiff = 0; | |
DateTime firstTime = System.now(); | |
do { | |
timeDiff = System.now().getTime() - firstTime.getTime(); | |
} | |
while(timeDiff <= milliseconds); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment