Class ThreadHandler


  • public final class ThreadHandler
    extends Object
    ThreadHandler is a common pattern used to control the safe handling of a sleeping thread.
    • Method Detail

      • safeSleep

        public static void safeSleep​(long millis)
        Sleep for the requested number of milliseconds
        Parameters:
        millis -
      • sleepUntil

        public static boolean sleepUntil​(Instant wakeUpTime)
        Sleep until we reach the target wakeUpTime
        Parameters:
        wakeUpTime -
        Returns:
        true if we woke up naturally, false if our sleep was interrupted