diff --git a/src/main/java/org/kiwiproject/retry/StopStrategies.java b/src/main/java/org/kiwiproject/retry/StopStrategies.java index cc650b9..acb1102 100644 --- a/src/main/java/org/kiwiproject/retry/StopStrategies.java +++ b/src/main/java/org/kiwiproject/retry/StopStrategies.java @@ -73,7 +73,7 @@ public static StopStrategy stopAfterDelay(long duration, @Nonnull TimeUnit timeU @Immutable private static final class NeverStopStrategy implements StopStrategy { @Override - public boolean shouldStop(Attempt failedAttempt) { + public boolean shouldStop(Attempt failedAttempt) { return false; } } @@ -88,7 +88,7 @@ private static final class StopAfterAttemptStrategy implements StopStrategy { } @Override - public boolean shouldStop(Attempt failedAttempt) { + public boolean shouldStop(Attempt failedAttempt) { return failedAttempt.getAttemptNumber() >= maxAttemptNumber; } } @@ -103,7 +103,7 @@ private static final class StopAfterDelayStrategy implements StopStrategy { } @Override - public boolean shouldStop(Attempt failedAttempt) { + public boolean shouldStop(Attempt failedAttempt) { return failedAttempt.getDelaySinceFirstAttempt() >= maxDelay; } } diff --git a/src/main/java/org/kiwiproject/retry/StopStrategy.java b/src/main/java/org/kiwiproject/retry/StopStrategy.java index 34784a3..1fd981b 100644 --- a/src/main/java/org/kiwiproject/retry/StopStrategy.java +++ b/src/main/java/org/kiwiproject/retry/StopStrategy.java @@ -28,5 +28,5 @@ public interface StopStrategy { * @param failedAttempt the previous failed {@code Attempt} * @return true if the retryer must stop, false otherwise */ - boolean shouldStop(Attempt failedAttempt); + boolean shouldStop(Attempt failedAttempt); } diff --git a/src/main/java/org/kiwiproject/retry/WaitStrategies.java b/src/main/java/org/kiwiproject/retry/WaitStrategies.java index fa2c9d2..ee55cb3 100644 --- a/src/main/java/org/kiwiproject/retry/WaitStrategies.java +++ b/src/main/java/org/kiwiproject/retry/WaitStrategies.java @@ -240,7 +240,7 @@ private static final class FixedWaitStrategy implements WaitStrategy { } @Override - public long computeSleepTime(Attempt failedAttempt) { + public long computeSleepTime(Attempt failedAttempt) { return sleepTime; } } @@ -260,7 +260,7 @@ private static final class RandomWaitStrategy implements WaitStrategy { } @Override - public long computeSleepTime(Attempt failedAttempt) { + public long computeSleepTime(Attempt failedAttempt) { long t = Math.abs(RANDOM.nextLong()) % (maximum - minimum); return t + minimum; } @@ -279,7 +279,7 @@ private static final class IncrementingWaitStrategy implements WaitStrategy { } @Override - public long computeSleepTime(Attempt failedAttempt) { + public long computeSleepTime(Attempt failedAttempt) { long result = initialSleepTime + (increment * (failedAttempt.getAttemptNumber() - 1)); return result >= 0L ? result : 0L; } @@ -300,7 +300,7 @@ private static final class ExponentialWaitStrategy implements WaitStrategy { } @Override - public long computeSleepTime(Attempt failedAttempt) { + public long computeSleepTime(Attempt failedAttempt) { double exp = Math.pow(2, failedAttempt.getAttemptNumber()); long result = Math.round(multiplier * exp); if (result > maximumWait) { @@ -324,7 +324,7 @@ private static final class FibonacciWaitStrategy implements WaitStrategy { } @Override - public long computeSleepTime(Attempt failedAttempt) { + public long computeSleepTime(Attempt failedAttempt) { long fib = fib(failedAttempt.getAttemptNumber()); long result = multiplier * fib; @@ -363,7 +363,7 @@ private static final class CompositeWaitStrategy implements WaitStrategy { } @Override - public long computeSleepTime(Attempt failedAttempt) { + public long computeSleepTime(Attempt failedAttempt) { long waitTime = 0L; for (WaitStrategy waitStrategy : waitStrategies) { waitTime += waitStrategy.computeSleepTime(failedAttempt); @@ -384,7 +384,7 @@ private static final class ExceptionWaitStrategy implements @SuppressWarnings({"unchecked"}) @Override - public long computeSleepTime(Attempt lastAttempt) { + public long computeSleepTime(Attempt lastAttempt) { if (lastAttempt.hasException()) { Throwable cause = lastAttempt.getException(); if (exceptionClass.isAssignableFrom(cause.getClass())) { diff --git a/src/main/java/org/kiwiproject/retry/WaitStrategy.java b/src/main/java/org/kiwiproject/retry/WaitStrategy.java index 4b292ba..51cb74f 100644 --- a/src/main/java/org/kiwiproject/retry/WaitStrategy.java +++ b/src/main/java/org/kiwiproject/retry/WaitStrategy.java @@ -28,5 +28,5 @@ public interface WaitStrategy { * @param failedAttempt the previous failed {@code Attempt} * @return the sleep time before next attempt */ - long computeSleepTime(Attempt failedAttempt); + long computeSleepTime(Attempt failedAttempt); }