Package com.norconex.commons.lang
Class Sleeper
- java.lang.Object
-
- com.norconex.commons.lang.Sleeper
-
public final class Sleeper extends Object
Convenience class to put to sleep the currently running thread. If sleeping fails, it throws a runtime exception of typeSleeperException- Author:
- Pascal Essiembre
-
-
Field Summary
Fields Modifier and Type Field Description static longONE_HOURNumber of milliseconds representing 1 hour.static longONE_MINUTENumber of milliseconds representing 1 minute.static longONE_SECONDNumber of milliseconds representing 1 second.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidsleepHours(int hours)Sleeps for the number of hours specified.static voidsleepMillis(long milliseconds)Sleeps for the number of milliseconds specified.static voidsleepMinutes(int minutes)Sleeps for the number of minutes specified.static voidsleepNanos(long nanoSeconds)Sleeps for the number of nanoseconds specified.static voidsleepSeconds(int seconds)Sleeps for the number of seconds specified.
-
-
-
Field Detail
-
ONE_SECOND
public static final long ONE_SECOND
Number of milliseconds representing 1 second.- See Also:
- Constant Field Values
-
ONE_MINUTE
public static final long ONE_MINUTE
Number of milliseconds representing 1 minute.- See Also:
- Constant Field Values
-
ONE_HOUR
public static final long ONE_HOUR
Number of milliseconds representing 1 hour.- See Also:
- Constant Field Values
-
-
Method Detail
-
sleepMillis
public static void sleepMillis(long milliseconds)
Sleeps for the number of milliseconds specified.- Parameters:
milliseconds- milliseconds
-
sleepNanos
public static void sleepNanos(long nanoSeconds)
Sleeps for the number of nanoseconds specified.- Parameters:
nanoSeconds- nanoseconds
-
sleepSeconds
public static void sleepSeconds(int seconds)
Sleeps for the number of seconds specified.- Parameters:
seconds- seconds
-
sleepMinutes
public static void sleepMinutes(int minutes)
Sleeps for the number of minutes specified.- Parameters:
minutes- minutes
-
sleepHours
public static void sleepHours(int hours)
Sleeps for the number of hours specified.- Parameters:
hours- hours
-
-