@Test public void basicTest() { Clock mockClock = Clock.fixed(Instant.EPOCH, ZoneId.systemDefault()); Backoff backoff = new Backoff(5, TimeUnit.MILLISECONDS, 60, TimeUnit.SECONDS, 60, TimeUnit.SECONDS, mockClock); assertTrue(checkExactAndDecrementTimer(backoff, 5)); assertTrue(withinTenPercentAndDecrementTimer(backoff, 10)); backoff.reset(); assertTrue(checkExactAndDecrementTimer(backoff, 5)); }
public void reset() { this.next = this.initial; this.mandatoryStopMade = false; }
Backoff { public void reset() { this.next = this.initial; this.mandatoryStopMade = false; } }
Backoff { public void reset() { this.next = this.initial; this.mandatoryStopMade = false; } @VisibleForTesting  Backoff(long initial, TimeUnit unitInitial, long max, TimeUnit unitMax, long mandatoryStop,
            TimeUnit unitMandatoryStop, Clock clock);  Backoff(long initial, TimeUnit unitInitial, long max, TimeUnit unitMax, long mandatoryStop,
                   TimeUnit unitMandatoryStop); }
Backoff { public void reset() { this.next = this.initial; this.mandatoryStopMade = false; } @VisibleForTesting  Backoff(long initial, TimeUnit unitInitial, long max, TimeUnit unitMax, long mandatoryStop,
            TimeUnit unitMandatoryStop, Clock clock);  Backoff(long initial, TimeUnit unitInitial, long max, TimeUnit unitMax, long mandatoryStop,
                   TimeUnit unitMandatoryStop); long next(); void reduceToHalf(); void reset(); static boolean shouldBackoff(long initialTimestamp, TimeUnit unitInitial, int failedAttempts,
    									long defaultInterval, long maxBackoffInterval); static boolean shouldBackoff(long initialTimestamp, TimeUnit unitInitial, int failedAttempts); }
Backoff { public void reset() { this.next = this.initial; this.mandatoryStopMade = false; } @VisibleForTesting  Backoff(long initial, TimeUnit unitInitial, long max, TimeUnit unitMax, long mandatoryStop,
            TimeUnit unitMandatoryStop, Clock clock);  Backoff(long initial, TimeUnit unitInitial, long max, TimeUnit unitMax, long mandatoryStop,
                   TimeUnit unitMandatoryStop); long next(); void reduceToHalf(); void reset(); static boolean shouldBackoff(long initialTimestamp, TimeUnit unitInitial, int failedAttempts,
    									long defaultInterval, long maxBackoffInterval); static boolean shouldBackoff(long initialTimestamp, TimeUnit unitInitial, int failedAttempts); static final long DEFAULT_INTERVAL_IN_NANOSECONDS; static final long MAX_BACKOFF_INTERVAL_NANOSECONDS; }