Package org.apache.druid.concurrent
Class Threads
- java.lang.Object
-
- org.apache.druid.concurrent.Threads
-
public final class Threads extends Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidsleepFor(long sleepTime, TimeUnit unit)Equivalent ofThread.sleep(long)with arguments and semantics of timed wait methods in classes fromjava.util.concurrent(likeSemaphore.tryAcquire(long, TimeUnit),Lock.tryLock(long, TimeUnit), etc.): if the sleepTime argument is negative or zero, the method returns immediately.
-
-
-
Method Detail
-
sleepFor
public static void sleepFor(long sleepTime, TimeUnit unit) throws InterruptedExceptionEquivalent ofThread.sleep(long)with arguments and semantics of timed wait methods in classes fromjava.util.concurrent(likeSemaphore.tryAcquire(long, TimeUnit),Lock.tryLock(long, TimeUnit), etc.): if the sleepTime argument is negative or zero, the method returns immediately.Thread.sleep(long), on the contrary, throws an IllegalArgumentException if the argument is negative and attempts to unschedule the thread if the argument is zero.- Throws:
InterruptedException- if the current thread is interrupted when this method is called or during sleeping.
-
-