All Articles

thread sleep

Do not use cryptic sleep statements like Thread.sleep(2000). You could have used of course:

Thread.sleep(Duration.ofSeconds(2).toMillis()).

Less cryptic, but still extremely verbose. Don’t use that either.

Instead:

TimeUnit.SECONDS.sleep(2)

Much better.