I did not understand the explanation at oracle, what is this piece of code actually doing?
final int maximumDelay = (int) TimeUnit.SECONDS.toMillis(1000);
It supports nanoseconds, microseconds, milliseconds, seconds, minutes, hours, and days units. For these units, TimeUnit specifies corresponding enum constants: Nanoseconds: One thousandth of a microsecond. Microseconds: One thousandth of a millisecond.
public enum TimeUnit extends Enum<TimeUnit> A TimeUnit represents time durations at a given unit of granularity and provides utility methods to convert across units, and to perform timing and delay operations in these units.
It converts 1000 seconds into milliseconds, then truncates the result from long
to int
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With