Class ThreadHandler
- java.lang.Object
-
- com.ibm.fhir.database.utils.thread.ThreadHandler
-
public final class ThreadHandler extends Object
ThreadHandler is a common pattern used to control the safe handling of a sleeping thread.
-
-
Field Summary
Fields Modifier and Type Field Description static longFIVE_SECONDSstatic longMINUTEstatic longSECONDstatic longTEN_SECONDS
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidsafeSleep(long millis)Sleep for the requested number of millisecondsstatic booleansleepUntil(Instant wakeUpTime)Sleep until we reach the target wakeUpTime
-
-
-
Field Detail
-
SECOND
public static final long SECOND
- See Also:
- Constant Field Values
-
FIVE_SECONDS
public static final long FIVE_SECONDS
- See Also:
- Constant Field Values
-
TEN_SECONDS
public static final long TEN_SECONDS
- See Also:
- Constant Field Values
-
MINUTE
public static final long MINUTE
- See Also:
- Constant Field Values
-
-
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
-
-