Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Consider using "TimeUnit.<unit>.sleep(x)" for code examples #1518

@polleyg

Description

@polleyg

In most code examples given (both in GitHub & official docs) where a sleep is needed, then Thread.sleep(x) is used. For example:

For better readability/clarity, then it may be prudent to consider using the TimeUnit class instead. Yes, it's all the same as it calls Thread.sleep(x) under the hood, but consider the following as an example:

Thread.sleep(180000) vs. TimeUnit.MINUTES.sleep(3)

More info: http://stackoverflow.com/questions/9587673/thread-sleep-vs-timeunit-seconds-sleep

Metadata

Metadata

Assignees

Labels

api: corepriority: p2Moderately-important priority. Fix may not be included in next release.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions