You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by GitBox <gi...@apache.org> on 2018/08/06 01:04:42 UTC

[GitHub] leventov commented on a change in pull request #5913: Move Caching Cluster Client to java streams and allow parallel intermediate merges

leventov commented on a change in pull request #5913: Move Caching Cluster Client to java streams and allow parallel intermediate merges
URL: https://github.com/apache/incubator-druid/pull/5913#discussion_r207752359
 
 

 ##########
 File path: java-util/src/main/java/io/druid/java/util/common/JodaUtils.java
 ##########
 @@ -138,4 +139,24 @@ public static DateTime maxDateTime(DateTime... times)
         return max;
     }
   }
+
+  /**
+   * Return a qty of millisconds approximately until deadline. If deadline has passed, throw TimeoutException
+   *
+   * @param deadline The time on or after which things should be considered "timed out"
+   *
+   * @return A millisecond number where, if one were to wait that many milliseconds, the deadline would
+   * probably have passed. Always greater than zero
+   *
+   * @throws TimeoutException If the deadline has already passed (ties are treated as having passed the deadline)
+   */
+  public static long timeoutForDeadline(DateTime deadline) throws TimeoutException
+  {
+    final DateTime now = DateTimes.nowUtc();
+    final long diff = deadline.getMillis() - now.getMillis();
+    if (now.isAfter(deadline) || diff == 0) {
 
 Review comment:
   What's the point of having both checks at the same time? `diff` and `isAfter`

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


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org