Skip to content

Commit

Permalink
doc: explicitly mention that Deadline might saturate
Browse files Browse the repository at this point in the history
  • Loading branch information
dapengzhang0 committed Aug 20, 2019
1 parent 3a9616f commit 9280571
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions context/src/main/java/io/grpc/Deadline.java
Expand Up @@ -55,6 +55,9 @@ public static Ticker getSystemTicker() {
* Create a deadline that will expire at the specified offset based on the {@link #getSystemTicker
* system ticker}.
*
* <p>If the given offset is extraordinarily long, say 100 years, the actual deadline created
* might saturate.
*
* @param duration A non-negative duration.
* @param units The time unit for the duration.
* @return A new deadline.
Expand All @@ -66,6 +69,9 @@ public static Deadline after(long duration, TimeUnit units) {
/**
* Create a deadline that will expire at the specified offset based on the given {@link Ticker}.
*
* <p>If the given offset is extraordinarily long, say 100 years, the actual deadline created
* might saturate.
*
* <p><strong>CAUTION</strong>: Only deadlines created with the same {@link Ticker} instance can
* be compared by methods like {@link #minimum}, {@link #isBefore} and {@link #compareTo}. Custom
* Tickers should only be used in tests where you fake out the clock. Always use the {@link
Expand Down Expand Up @@ -141,6 +147,9 @@ public Deadline minimum(Deadline other) {

/**
* Create a new deadline that is offset from {@code this}.
*
* <p>If the given offset is extraordinarily long, say 100 years, the actual deadline created
* might saturate.
*/
// TODO(ejona): This method can cause deadlines to grow too far apart. For example:
// Deadline.after(100 * 365, DAYS).offset(100 * 365, DAYS) would be less than
Expand Down

0 comments on commit 9280571

Please sign in to comment.