GH-319: Fix Javabean Setter Collision

Resolves https://github.com/spring-projects/spring-retry/issues/319

Regression: 47c1e52900

Multiple setters with different types.
This commit is contained in:
Gary Russell
2022-10-17 16:32:44 -04:00
committed by Artem Bilan
parent c09c979852
commit 4eeab7d380
7 changed files with 21 additions and 21 deletions

View File

@@ -275,7 +275,7 @@ public class AnnotationAwareRetryOperationsInterceptor implements IntroductionIn
}
}
else {
breaker.setOpenTimeout(() -> evaluate(parsed, Long.class, false));
breaker.openTimeoutSupplier(() -> evaluate(parsed, Long.class, false));
return;
}
}
@@ -294,7 +294,7 @@ public class AnnotationAwareRetryOperationsInterceptor implements IntroductionIn
}
}
else {
breaker.setResetTimeout(() -> evaluate(parsed, Long.class, false));
breaker.resetTimeoutSupplier(() -> evaluate(parsed, Long.class, false));
}
}
breaker.setResetTimeout(circuit.resetTimeout());
@@ -366,7 +366,7 @@ public class AnnotationAwareRetryOperationsInterceptor implements IntroductionIn
? new ExpressionRetryPolicy(resolve(exceptionExpression)).withBeanFactory(this.beanFactory)
: new SimpleRetryPolicy();
if (expression != null) {
simple.setMaxAttempts(() -> evaluate(expression, Integer.class, stateless));
simple.maxAttemptsSupplier(() -> evaluate(expression, Integer.class, stateless));
}
else {
simple.setMaxAttempts(maxAttempts);
@@ -388,7 +388,7 @@ public class AnnotationAwareRetryOperationsInterceptor implements IntroductionIn
else {
simple = new SimpleRetryPolicy(maxAttempts, policyMap, true, retryNotExcluded);
if (expression != null) {
simple.setMaxAttempts(() -> evaluate(expression, Integer.class, stateless));
simple.maxAttemptsSupplier(() -> evaluate(expression, Integer.class, stateless));
}
}
}

View File

@@ -227,20 +227,20 @@ public class BackOffPolicyBuilder {
policy.setInitialInterval(this.delay);
}
if (this.delaySupplier != null) {
policy.setInitialInterval(this.delaySupplier);
policy.initialIntervalSupplier(this.delaySupplier);
}
if (this.multiplier != null) {
policy.setMultiplier(this.multiplier);
}
if (this.multiplierSupplier != null) {
policy.setMultiplier(this.multiplierSupplier);
policy.multiplierSupplier(this.multiplierSupplier);
}
if (this.maxDelay != null && this.delay != null) {
policy.setMaxInterval(
this.maxDelay > this.delay ? this.maxDelay : ExponentialBackOffPolicy.DEFAULT_MAX_INTERVAL);
}
if (this.maxDelaySupplier != null) {
policy.setMaxInterval(this.maxDelaySupplier);
policy.maxIntervalSupplier(this.maxDelaySupplier);
}
if (this.sleeper != null) {
policy.setSleeper(this.sleeper);
@@ -253,13 +253,13 @@ public class BackOffPolicyBuilder {
policy.setMinBackOffPeriod(this.delay);
}
if (this.delaySupplier != null) {
policy.setMinBackOffPeriod(this.delaySupplier);
policy.minBackOffPeriodSupplier(this.delaySupplier);
}
if (this.maxDelay != null) {
policy.setMaxBackOffPeriod(this.maxDelay);
}
if (this.maxDelaySupplier != null) {
policy.setMaxBackOffPeriod(this.maxDelaySupplier);
policy.maxBackOffPeriodSupplier(this.maxDelaySupplier);
}
if (this.sleeper != null) {
policy.setSleeper(this.sleeper);

View File

@@ -157,7 +157,7 @@ public class ExponentialBackOffPolicy implements SleepingBackOffPolicy<Exponenti
* @param initialIntervalSupplier the initial interval
* @since 2.0
*/
public void setInitialInterval(Supplier<Long> initialIntervalSupplier) {
public void initialIntervalSupplier(Supplier<Long> initialIntervalSupplier) {
Assert.notNull(initialIntervalSupplier, "'initialIntervalSupplier' cannot be null");
this.initialIntervalSupplier = initialIntervalSupplier;
}
@@ -168,7 +168,7 @@ public class ExponentialBackOffPolicy implements SleepingBackOffPolicy<Exponenti
* @param multiplierSupplier the multiplier
* @since 2.0
*/
public void setMultiplier(Supplier<Double> multiplierSupplier) {
public void multiplierSupplier(Supplier<Double> multiplierSupplier) {
Assert.notNull(multiplierSupplier, "'multiplierSupplier' cannot be null");
this.multiplierSupplier = multiplierSupplier;
}
@@ -181,7 +181,7 @@ public class ExponentialBackOffPolicy implements SleepingBackOffPolicy<Exponenti
* @param maxIntervalSupplier in milliseconds.
* @since 2.0
*/
public void setMaxInterval(Supplier<Long> maxIntervalSupplier) {
public void maxIntervalSupplier(Supplier<Long> maxIntervalSupplier) {
Assert.notNull(maxIntervalSupplier, "'maxIntervalSupplier' cannot be null");
this.maxIntervalSupplier = maxIntervalSupplier;
}

View File

@@ -48,7 +48,7 @@ public class FixedBackOffPolicy extends StatelessBackOffPolicy implements Sleepi
public FixedBackOffPolicy withSleeper(Sleeper sleeper) {
FixedBackOffPolicy res = new FixedBackOffPolicy();
res.setBackOffPeriod(backOffPeriod);
res.backOffPeriodSupplier(backOffPeriod);
res.setSleeper(sleeper);
return res;
}
@@ -75,7 +75,7 @@ public class FixedBackOffPolicy extends StatelessBackOffPolicy implements Sleepi
* @param backOffPeriodSupplier the back off period
* @since 2.0
*/
public void setBackOffPeriod(Supplier<Long> backOffPeriodSupplier) {
public void backOffPeriodSupplier(Supplier<Long> backOffPeriodSupplier) {
Assert.notNull(backOffPeriodSupplier, "'backOffPeriodSupplier' cannot be null");
this.backOffPeriod = backOffPeriodSupplier;
}

View File

@@ -56,8 +56,8 @@ public class UniformRandomBackOffPolicy extends StatelessBackOffPolicy
public UniformRandomBackOffPolicy withSleeper(Sleeper sleeper) {
UniformRandomBackOffPolicy res = new UniformRandomBackOffPolicy();
res.setMinBackOffPeriod(minBackOffPeriod);
res.setMaxBackOffPeriod(maxBackOffPeriod);
res.minBackOffPeriodSupplier(minBackOffPeriod);
res.maxBackOffPeriodSupplier(maxBackOffPeriod);
res.setSleeper(sleeper);
return res;
}
@@ -85,7 +85,7 @@ public class UniformRandomBackOffPolicy extends StatelessBackOffPolicy
* @param backOffPeriodSupplier the backoff period
* @since 2.0
*/
public void setMinBackOffPeriod(Supplier<Long> backOffPeriodSupplier) {
public void minBackOffPeriodSupplier(Supplier<Long> backOffPeriodSupplier) {
Assert.notNull(backOffPeriodSupplier, "'backOffPeriodSupplier' cannot be null");
this.minBackOffPeriod = backOffPeriodSupplier;
}
@@ -113,7 +113,7 @@ public class UniformRandomBackOffPolicy extends StatelessBackOffPolicy
* @param backOffPeriodSupplier the back off period
* @since 2.0
*/
public void setMaxBackOffPeriod(Supplier<Long> backOffPeriodSupplier) {
public void maxBackOffPeriodSupplier(Supplier<Long> backOffPeriodSupplier) {
Assert.notNull(backOffPeriodSupplier, "'backOffPeriodSupplier' cannot be null");
this.maxBackOffPeriod = backOffPeriodSupplier;
}

View File

@@ -73,7 +73,7 @@ public class CircuitBreakerRetryPolicy implements RetryPolicy {
* @param timeoutSupplier a supplier for the timeout to set in milliseconds
* @since 2.0
*/
public void setResetTimeout(Supplier<Long> timeoutSupplier) {
public void resetTimeoutSupplier(Supplier<Long> timeoutSupplier) {
this.resetTimeoutSupplier = timeoutSupplier;
}
@@ -94,7 +94,7 @@ public class CircuitBreakerRetryPolicy implements RetryPolicy {
* @param timeoutSupplier a supplier for the timeout to set in milliseconds
* @since 2.0
*/
public void setOpenTimeout(Supplier<Long> timeoutSupplier) {
public void openTimeoutSupplier(Supplier<Long> timeoutSupplier) {
this.openTimeoutSupplier = timeoutSupplier;
}

View File

@@ -183,7 +183,7 @@ public class SimpleRetryPolicy implements RetryPolicy {
* attempt.
* @since 2.0
*/
public void setMaxAttempts(Supplier<Integer> maxAttemptsSupplier) {
public void maxAttemptsSupplier(Supplier<Integer> maxAttemptsSupplier) {
Assert.notNull(maxAttemptsSupplier, "'maxAttemptsSupplier' cannot be null");
this.maxAttemptsSupplier = maxAttemptsSupplier;
}