dawidwys commented on a change in pull request #18745:
URL: https://github.com/apache/flink/pull/18745#discussion_r809114806



##########
File path: 
flink-core/src/main/java/org/apache/flink/api/common/time/Deadline.java
##########
@@ -103,11 +107,23 @@ public static Deadline fromNow(Duration duration) {
      * @param clock Time provider for this deadline.
      */
     public static Deadline fromNowWithClock(Duration duration, Clock clock) {
-        return new Deadline(Math.addExact(clock.relativeTimeNanos(), 
duration.toNanos()), clock);
+        return new Deadline(
+                addHandlingOverflow(clock.relativeTimeNanos(), 
duration.toNanos()), clock);
     }
 
     @Override
     public String toString() {
         return LocalDateTime.now().plus(timeLeft()).toString();
     }
+
+    // -------------------- private helper methods ----------------
+
+    private static long addHandlingOverflow(long x, long y) {

Review comment:
       nit: we could add a comment it has been copied over from `Math#addExact` 
and we changed the overflow behaviour.




-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to