Class Threads

java.lang.Object
io.bdeploy.common.util.Threads

public class Threads extends Object
Common helpers for waiting and sleeping.
  • Method Details

    • wait

      public static boolean wait(Object lock, BooleanSupplier condition)
      Waits until notified or interrupted or the condition is met. The caller needs to be the owner of the lock.
      Returns:
      false if 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:
      false if the thread was interrupted while sleeping