public abstract class TimeoutUtils extends Object
| Constructor and Description |
|---|
TimeoutUtils() |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
hasMillis(Duration duration)
Check if a given Duration can be represented in
sec or requires msec representation. |
static double |
toDoubleSeconds(long timeout,
TimeUnit unit)
Converts the given timeout to seconds with a fraction of seconds.
|
static long |
toMillis(long timeout,
TimeUnit unit)
Converts the given timeout to milliseconds.
|
static long |
toSeconds(Duration duration)
Converts the given timeout to seconds.
|
static long |
toSeconds(long timeout,
TimeUnit unit)
Converts the given timeout to seconds.
|
public static boolean hasMillis(Duration duration)
sec or requires msec representation.public static long toSeconds(Duration duration)
Since a 0 timeout blocks some Redis ops indefinitely, this method will return 1 if the original value is greater than 0 but is truncated to 0 on conversion.
duration - The duration to convertpublic static long toSeconds(long timeout,
TimeUnit unit)
Since a 0 timeout blocks some Redis ops indefinitely, this method will return 1 if the original value is greater than 0 but is truncated to 0 on conversion.
timeout - The timeout to convertunit - The timeout's unitpublic static double toDoubleSeconds(long timeout,
TimeUnit unit)
timeout - The timeout to convertunit - The timeout's unitpublic static long toMillis(long timeout,
TimeUnit unit)
Since a 0 timeout blocks some Redis ops indefinitely, this method will return 1 if the original value is greater than 0 but is truncated to 0 on conversion.
timeout - The timeout to convertunit - The timeout's unitCopyright © 2011–2022 Pivotal Software, Inc.. All rights reserved.