public static long earliestTime(long loadTime, long candidate1, long candidate2) {
    if (candidate1 >= loadTime) {
      if (candidate1 < candidate2 || candidate2 < loadTime) {
        return candidate1;
      }
    }
    if (candidate2 >= loadTime) {
      return candidate2;
    }
    return ETERNAL;
  }
public static long earliestTime ( long loadTime , long candidate1 , long candidate2 ) { if ( candidate1 >= loadTime ) { if ( candidate1 < candidate2 || candidate2 < loadTime ) { return candidate1 ; } } if ( candidate2 >= loadTime ) { return candidate2 ; } return ETERNAL ; }
Helper to calculate the next expiry out of two expiry times that
may be up next. Return the time value that is closest or equal to
the current time. Time values in the past are ignored. If all times
are in the past, returns {@link #ETERNAL}.

@param loadTime the current time in millis since epoch
@param candidate1 candidate time for next expiry
@param candidate2 candidate time for next expiry
@return either first or second candidate or {@link #ETERNAL}