Package com.helger.commons.concurrent
Class ThreadHelper
- java.lang.Object
-
- com.helger.commons.concurrent.ThreadHelper
-
@Immutable public final class ThreadHelper extends Object
Some thread utility methods.- Author:
- Philip Helger
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static ESuccesssleep(long nMilliseconds)Sleep the current thread for a certain amount of timestatic ESuccesssleep(long nDuration, TimeUnit aTimeUnit)Sleep the current thread for a certain amount of timestatic ESuccesssleep(Duration aDuration)Sleep the current thread for a certain amount of timestatic ESuccesssleepMinutes(long nMinutes)Sleep the current thread for a certain amount of timestatic ESuccesssleepSeconds(long nSeconds)Sleep the current thread for a certain amount of time
-
-
-
Method Detail
-
sleepMinutes
@Nonnull public static ESuccess sleepMinutes(@Nonnegative long nMinutes)
Sleep the current thread for a certain amount of time- Parameters:
nMinutes- The minutes to sleep. Must be ≥ 0.- Returns:
ESuccess.SUCCESSif sleeping was not interrupted,ESuccess.FAILUREif sleeping was interrupted
-
sleepSeconds
@Nonnull public static ESuccess sleepSeconds(@Nonnegative long nSeconds)
Sleep the current thread for a certain amount of time- Parameters:
nSeconds- The seconds to sleep. Must be ≥ 0.- Returns:
ESuccess.SUCCESSif sleeping was not interrupted,ESuccess.FAILUREif sleeping was interrupted
-
sleep
@Nonnull public static ESuccess sleep(@Nonnull Duration aDuration)
Sleep the current thread for a certain amount of time- Parameters:
aDuration- The time value to use. May not benull.- Returns:
ESuccess.SUCCESSif sleeping was not interrupted,ESuccess.FAILUREif sleeping was interrupted
-
sleep
@Nonnull public static ESuccess sleep(@Nonnegative long nDuration, @Nonnull TimeUnit aTimeUnit)
Sleep the current thread for a certain amount of time- Parameters:
nDuration- The duration to sleep. Must be ≥ 0.aTimeUnit- The time unit to use. May not benull.- Returns:
ESuccess.SUCCESSif sleeping was not interrupted,ESuccess.FAILUREif sleeping was interrupted
-
sleep
@Nonnull public static ESuccess sleep(@Nonnegative long nMilliseconds)
Sleep the current thread for a certain amount of time- Parameters:
nMilliseconds- The milliseconds to sleep. Must be ≥ 0.- Returns:
ESuccess.SUCCESSif sleeping was not interrupted,ESuccess.FAILUREif sleeping was interrupted
-
-