zhuzhurk commented on a change in pull request #10551: [FLINK-13662][kinesis] 
Relax timing requirements
URL: https://github.com/apache/flink/pull/10551#discussion_r360394234
 
 

 ##########
 File path: 
flink-core/src/main/java/org/apache/flink/api/common/time/Deadline.java
 ##########
 @@ -47,6 +48,19 @@ public Duration timeLeft() {
                return Duration.ofNanos(Math.subtractExact(timeNanos, 
System.nanoTime()));
        }
 
+       /**
+        * Returns the time left between the deadline and now. If no time is 
left, a {@link TimeoutException} will be thrown.
+        *
+        * @throws TimeoutException if no time is left
+        */
+       public Duration timeLeftIfAny() throws TimeoutException {
+               long nanos = Math.subtractExact(timeNanos, System.nanoTime());
+               if (nanos <= 0) {
+                       throw new TimeoutException();
+               }
+               return Duration.ofNanos(nanos);
 
 Review comment:
   Oh yes my bad to misunderstand the problem.
   Thanks for the explanation!

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to