Class Deadline
- java.lang.Object
-
- nl.esciencecenter.xenon.adaptors.schedulers.Deadline
-
public class Deadline extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description Deadline()No need to use this constructor, use static methods instead.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static longgetDeadline(long timeout)Calculate the epoch timestamp when a timeout will expire.
-
-
-
Method Detail
-
getDeadline
public static long getDeadline(long timeout)
Calculate the epoch timestamp when a timeout will expire. This deadline is computed by adding thetimeouttoSystem.currentTimeMillis(). This computation is protected against overflow, that is, the deadline will never exceedLong.MAX_VALUE. This allows the user to simply test if the deadline has passed by performing a check against the current epoch time:if (deadline <= System.currentTimeMillis()) { // deadline has passed }- Parameters:
timeout- the timeout to compute the deadline with. Must be >= 0 or an IllegalArgumentException will be thrown.- Returns:
- the timestamp at which the timeout will expire, or
Long.MAX_VALUEif the timeout causes an overflow.
-
-