Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
public void waitAMinute() {
reallyReallyWait(60000);
}
public void reallyReallyWait(int millis) {
int before = System.currentTimeMillis();
try {
Thread.sleep(millis);
}
catch (InterruptedException | StackOverflowError e) {
int after = System.currentTimeMillis();
int elapsed = after - before;
// Make sure we really, REALLY wait the full allotted time.
reallyReallyWait(millis - elapsed);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.