Interface Sleeper

All Known Implementing Classes:
SystemSleeper

@ThreadSafe public interface Sleeper
An object which accepts requests to put the current thread to sleep.
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    sleep(org.joda.time.ReadableDuration duration)
    Puts the current thread to sleep.
    default void
    sleepInterruptibly(org.joda.time.ReadableDuration duration)
    Puts the current thread to interruptible sleep.
    void
    sleepUninterruptibly(org.joda.time.ReadableDuration duration)
    Puts the current thread to sleep, ignoring interrupts.
  • Method Details

    • sleep

      void sleep(org.joda.time.ReadableDuration duration) throws InterruptedException
      Puts the current thread to sleep.
      Throws:
      InterruptedException - if this thread was interrupted
    • sleepUninterruptibly

      void sleepUninterruptibly(org.joda.time.ReadableDuration duration)
      Puts the current thread to sleep, ignoring interrupts.

      If InterruptedException was caught, then Thread.currentThread().interrupt() will be called at the end of the duration.

      See Also:
      • Uninterruptibles.sleepUninterruptibly(java.time.Duration)
    • sleepInterruptibly

      default void sleepInterruptibly(org.joda.time.ReadableDuration duration)
      Puts the current thread to interruptible sleep.

      This is a convenience method for sleep(org.joda.time.ReadableDuration) that properly converts an InterruptedException to a RuntimeException.