Skip to content

Instantly share code, notes, and snippets.

@SalesforceBobLightning
Created April 5, 2019 06:44
Show Gist options
  • Save SalesforceBobLightning/d38bd32614df6ce445c8881f128e332a to your computer and use it in GitHub Desktop.
Save SalesforceBobLightning/d38bd32614df6ce445c8881f128e332a to your computer and use it in GitHub Desktop.
Thread sleep helper method for Salesforce Apex
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