Skip to content

Commit

Permalink
Merge pull request #150 from smallrye/features/revert-breaking-change
Browse files Browse the repository at this point in the history
Revert the renaming of UniRetry as it introduced an API breaking change
  • Loading branch information
cescoffier authored May 27, 2020
2 parents 686c6a7 + 31ba8aa commit b65ffa9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ public Uni<T> recoverWithUni(Uni<? extends T> fallback) {
return recoverWithUni(() -> fallback);
}

public UniOnFailureRetry<T> retry() {
return new UniOnFailureRetry<>(upstream, predicate);
public UniRetry<T> retry() {
return new UniRetry<>(upstream, predicate);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
import io.smallrye.mutiny.infrastructure.Infrastructure;
import io.smallrye.mutiny.operators.UniRetryAtMost;

public class UniOnFailureRetry<T> {
// TODO This method should be renamed to UniOnFailureRetry, however it's a breaking change.
public class UniRetry<T> {

private final Uni<T> upstream;
private final Predicate<? super Throwable> predicate;
Expand All @@ -26,7 +27,7 @@ public class UniOnFailureRetry<T> {

private boolean backOffConfigured = false;

public UniOnFailureRetry(Uni<T> upstream, Predicate<? super Throwable> predicate) {
public UniRetry(Uni<T> upstream, Predicate<? super Throwable> predicate) {
this.upstream = upstream;
this.predicate = predicate;
}
Expand Down Expand Up @@ -118,7 +119,7 @@ public Uni<T> when(Function<Multi<Throwable>, ? extends Publisher<?>> whenStream
* @param initialBackOff the initial back-off duration, must not be {@code null}, must not be negative.
* @return this object to configure the retry policy.
*/
public UniOnFailureRetry<T> withBackOff(Duration initialBackOff) {
public UniRetry<T> withBackOff(Duration initialBackOff) {
return withBackOff(initialBackOff, ExponentialBackoff.MAX_BACKOFF);
}

Expand All @@ -130,7 +131,7 @@ public UniOnFailureRetry<T> withBackOff(Duration initialBackOff) {
* @param maxBackOff the max back-off duration, must not be {@code null}, must not be negative.
* @return this object to configure the retry policy.
*/
public UniOnFailureRetry<T> withBackOff(Duration initialBackOff, Duration maxBackOff) {
public UniRetry<T> withBackOff(Duration initialBackOff, Duration maxBackOff) {
this.backOffConfigured = true;
this.initialBackOffDuration = validate(initialBackOff, "initialBackOff");
this.maxBackoffDuration = validate(maxBackOff, "maxBackOff");
Expand All @@ -143,7 +144,7 @@ public UniOnFailureRetry<T> withBackOff(Duration initialBackOff, Duration maxBac
* @param jitter the jitter. Must be in [0.0, 1.0]
* @return this object to configure the retry policy.
*/
public UniOnFailureRetry<T> withJitter(double jitter) {
public UniRetry<T> withJitter(double jitter) {
if (jitter < 0 || jitter > 1.0) {
throw new IllegalArgumentException("Invalid `jitter`, the value must be in [0.0, 1.0]");
}
Expand Down

0 comments on commit b65ffa9

Please sign in to comment.