Skip to content

Commit

Permalink
addressing comment
Browse files Browse the repository at this point in the history
  • Loading branch information
Anton Aharkau committed Nov 14, 2023
1 parent 27011f1 commit 06cd6d5
Showing 1 changed file with 7 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public class ExponentialBackOffPolicy implements SleepingBackOffPolicy<Exponenti
* The default 'initialInterval' value - 1000 millisecs. Coupled with the default
* 'multiplier' value this gives a useful initial spread of pauses for 1-5 retries.
*/
public static final long DEFAULT_INITIAL_INTERVAL = 1000L;
public static final long DEFAULT_INITIAL_INTERVAL = 100L;

/**
* The default maximum backoff time (30 seconds).
Expand Down Expand Up @@ -259,7 +259,7 @@ static class ExponentialBackOffContext implements BackOffContext {

private final long maxInterval;

private final Supplier<Long> initialIntervalSupplier;
private Supplier<Long> initialIntervalSupplier;

private Supplier<Double> multiplierSupplier;

Expand Down Expand Up @@ -289,25 +289,19 @@ public synchronized long getSleepAndIncrement() {
}

protected long getNextInterval() {
if (this.initialIntervalSupplier == null || this.interval != DEFAULT_INITIAL_INTERVAL) {
return (long) (this.interval * getMultiplier());
}
else {
return (long) (this.initialIntervalSupplier.get() * getMultiplier());
}
return (long) (this.interval * getMultiplier());
}

public double getMultiplier() {
return this.multiplierSupplier != null ? this.multiplierSupplier.get() : this.multiplier;
}

public long getInterval() {
if (initialIntervalSupplier == null || this.interval != DEFAULT_INITIAL_INTERVAL) {
return this.interval;
}
else {
return this.initialIntervalSupplier.get();
if (this.initialIntervalSupplier != null) {
this.interval = this.initialIntervalSupplier.get();
this.initialIntervalSupplier = null;
}
return this.interval;
}

public long getMaxInterval() {
Expand Down

0 comments on commit 06cd6d5

Please sign in to comment.