return true; long sleepTime = nextMaxInterval(i++, end); if (sleepTime > 0) Thread.sleep(sleepTime); now = System.currentTimeMillis();
try { long i = 1l; for (Date end = new Date(System.currentTimeMillis() + timeout); before(end); Thread.sleep(nextMaxInterval(i++, end))) { if (findOrBreak.apply(input)) { return true; } else if (atOrAfter(end)) { return false;
return true; long sleepTime = nextMaxInterval(i++, end); if (sleepTime > 0) Thread.sleep(sleepTime); now = System.currentTimeMillis();
return true; long sleepTime = nextMaxInterval(i++, end); if (sleepTime > 0) Thread.sleep(sleepTime); now = System.currentTimeMillis();
try { long i = 1l; for (Date end = new Date(System.currentTimeMillis() + timeout); before(end); Thread.sleep(nextMaxInterval(i++, end))) { if (findOrBreak.apply(input)) { return true; } else if (atOrAfter(end)) { return false;
try { long i = 1l; for (Date end = new Date(System.currentTimeMillis() + timeout); before(end); Thread.sleep(nextMaxInterval(i++, end))) { if (findOrBreak.apply(input)) { return true; } else if (atOrAfter(end)) { return false;
/** * @deprecated since 1.9.0; use {@link #nextMaxInterval(long, long)} */ @Deprecated protected long nextMaxInterval(long attempt, Date end) { return nextMaxInterval(attempt, end.getTime()); }
/** * Retries a predicate until it is met, a timeout occurs, or an exception occurs. */ public static <T> Predicate<T> retry(Predicate<T> findOrBreak, long timeout, long period, long maxPeriod, TimeUnit unit) { return new RetryablePredicate<T>(findOrBreak, timeout, period, maxPeriod, unit); }
/** * Retries a predicate until it is met, a timeout occurs, or an exception occurs. */ public static <T> Predicate<T> retry(Predicate<T> findOrBreak, long timeout, long period, long maxPeriod, TimeUnit unit) { return new RetryablePredicate<T>(findOrBreak, timeout, period, maxPeriod, unit); }
/** * @deprecated since 1.9.0; use {@link #nextMaxInterval(long, long)} */ @Deprecated protected long nextMaxInterval(long attempt, Date end) { return nextMaxInterval(attempt, end.getTime()); }
/** * Retries a predicate until it is met, a timeout occurs, or an exception occurs. */ public static <T> Predicate<T> retry(Predicate<T> findOrBreak, long timeout, long period, long maxPeriod, TimeUnit unit) { return new RetryablePredicate<T>(findOrBreak, timeout, period, maxPeriod, unit); }
/** * Retries a predicate until it is met, a timeout occurs, or an exception occurs. */ public static <T> Predicate<T> retry(Predicate<T> findOrBreak, long timeout, long period, long maxPeriod, TimeUnit unit) { return new RetryablePredicate<T>(findOrBreak, timeout, period, maxPeriod, unit); }
/** * @deprecated since 1.9.0; use {@link #nextMaxInterval(long, long)} */ @Deprecated protected long nextMaxInterval(long attempt, Date end) { return nextMaxInterval(attempt, end.getTime()); }
/** * Retries a predicate until it is met, a timeout occurs, or an exception occurs. */ public static <T> Predicate<T> retry(Predicate<T> findOrBreak, long timeout, long period, long maxPeriod, TimeUnit unit) { return new RetryablePredicate<T>(findOrBreak, timeout, period, maxPeriod, unit); }
/** * Retries a predicate until it is met, a timeout occurs, or an exception occurs. */ public static <T> Predicate<T> retry(Predicate<T> findOrBreak, long timeout, long period, long maxPeriod, TimeUnit unit) { return new RetryablePredicate<T>(findOrBreak, timeout, period, maxPeriod, unit); }