public final class ThreadUtils
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static void |
busySpin(int value,
java.util.concurrent.TimeUnit unit)
Busy-spins the thread for the specified time interval
|
static void |
sleep(int value,
java.util.concurrent.TimeUnit unit)
Puts the thread to the sleep state, for the specified time interval, unless an interrupt makes it runnable again
|
static void |
yieldWait(int value,
java.util.concurrent.TimeUnit unit)
Performs a yielding wait for the specified time interval
|
public static void sleep(int value, java.util.concurrent.TimeUnit unit)
java.lang.InterruptedException
- Another thread interrupted this threadjava.lang.IllegalStateException
- An un-recognised time unit was givenpublic static void busySpin(int value, java.util.concurrent.TimeUnit unit)
java.lang.InterruptedException
- Another thread interrupted this threadjava.lang.IllegalStateException
- An un-recognised time unit was givenpublic static void yieldWait(int value, java.util.concurrent.TimeUnit unit)
java.lang.InterruptedException
- Another thread interrupted this threadjava.lang.IllegalStateException
- An un-recognised time unit was given