Package io.bdeploy.common.util
Class Threads
java.lang.Object
io.bdeploy.common.util.Threads
Common helpers for waiting and sleeping.
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleansleep(long millis) Causes the current thread to sleep the given amount of time or until interrupted.static booleanwait(Object lock, BooleanSupplier condition) Waits until notified or interrupted or the condition is met.
-
Method Details
-
wait
Waits until notified or interrupted or the condition is met. The caller needs to be the owner of the lock.- Returns:
falseif the thread was interrupted while waiting
-
sleep
public static boolean sleep(long millis) Causes the current thread to sleep the given amount of time or until interrupted.- Parameters:
millis- the length of time to sleep in milliseconds- Returns:
falseif the thread was interrupted while sleeping
-