Package org.apache.flink.api.common.time
Class Deadline
- java.lang.Object
-
- org.apache.flink.api.common.time.Deadline
-
@Internal public class Deadline extends Object
This class stores a deadline, as obtained vianow()or fromplus(Duration).
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static DeadlinefromNow(java.time.Duration duration)Constructs a Deadline that is a given duration after now.static DeadlinefromNowWithClock(java.time.Duration duration, Clock clock)Constructs a Deadline that is a given duration after now, where now and all other times from this deadline are defined by the givenClock.booleanhasTimeLeft()Returns whether there is any time left between the deadline and now.booleanisOverdue()Determines whether the deadline is in the past, i.e.static Deadlinenow()Constructs aDeadlinethat has now as the deadline.Deadlineplus(java.time.Duration other)java.time.DurationtimeLeft()Returns the time left between the deadline and now.java.time.DurationtimeLeftIfAny()Returns the time left between the deadline and now.StringtoString()
-
-
-
Method Detail
-
plus
public Deadline plus(java.time.Duration other)
-
timeLeft
public java.time.Duration timeLeft()
Returns the time left between the deadline and now. The result is negative if the deadline has passed.
-
timeLeftIfAny
public java.time.Duration timeLeftIfAny() throws TimeoutExceptionReturns the time left between the deadline and now. If no time is left, aTimeoutExceptionwill be thrown.- Throws:
TimeoutException- if no time is left
-
hasTimeLeft
public boolean hasTimeLeft()
Returns whether there is any time left between the deadline and now.
-
isOverdue
public boolean isOverdue()
Determines whether the deadline is in the past, i.e. whether the time left is zero or negative.
-
now
public static Deadline now()
Constructs aDeadlinethat has now as the deadline. Use this and then extend viaplus(Duration)to specify a deadline in the future.
-
fromNow
public static Deadline fromNow(java.time.Duration duration)
Constructs a Deadline that is a given duration after now.
-
fromNowWithClock
public static Deadline fromNowWithClock(java.time.Duration duration, Clock clock)
Constructs a Deadline that is a given duration after now, where now and all other times from this deadline are defined by the givenClock.- Parameters:
duration- Duration for this deadline.clock- Time provider for this deadline.
-
-