Browse Source

Polish @⁠Retryable Javadoc and internals

pull/35086/head
Sam Brannen 6 months ago
parent
commit
c5fd57d92b
  1. 1
      spring-aop/src/main/java/org/springframework/aop/retry/AbstractRetryInterceptor.java
  2. 6
      spring-aop/src/main/java/org/springframework/aop/retry/MethodRetrySpec.java
  3. 4
      spring-aop/src/main/java/org/springframework/aop/retry/annotation/RetryAnnotationBeanPostProcessor.java
  4. 8
      spring-aop/src/main/java/org/springframework/aop/retry/annotation/Retryable.java
  5. 10
      spring-core/src/main/java/org/springframework/util/backoff/ExponentialBackOff.java

1
spring-aop/src/main/java/org/springframework/aop/retry/AbstractRetryInterceptor.java

@ -118,7 +118,6 @@ public abstract class AbstractRetryInterceptor implements MethodInterceptor { @@ -118,7 +118,6 @@ public abstract class AbstractRetryInterceptor implements MethodInterceptor {
}
@Override
public String getName() {
Object target = invocation.getThis();
return ClassUtils.getQualifiedMethodName(method, (target != null ? target.getClass() : null));
}
});

6
spring-aop/src/main/java/org/springframework/aop/retry/MethodRetrySpec.java

@ -26,8 +26,8 @@ import java.util.Collections; @@ -26,8 +26,8 @@ import java.util.Collections;
*
* @author Juergen Hoeller
* @since 7.0
* @param includes applicable exceptions types to attempt a retry for
* @param excludes non-applicable exceptions types to avoid a retry for
* @param includes applicable exception types to attempt a retry for
* @param excludes non-applicable exception types to avoid a retry for
* @param predicate a predicate for filtering exceptions from applicable methods
* @param maxAttempts the maximum number of retry attempts
* @param delay the base delay after the initial invocation (in milliseconds)
@ -49,7 +49,7 @@ public record MethodRetrySpec( @@ -49,7 +49,7 @@ public record MethodRetrySpec(
long maxDelay) {
public MethodRetrySpec(MethodRetryPredicate predicate, int maxAttempts, long delay) {
this(predicate, maxAttempts, delay, 0,1.0, Integer.MAX_VALUE);
this(predicate, maxAttempts, delay, 0, 1.0, Integer.MAX_VALUE);
}
public MethodRetrySpec(MethodRetryPredicate predicate, int maxAttempts, long delay,

4
spring-aop/src/main/java/org/springframework/aop/retry/annotation/RetryAnnotationBeanPostProcessor.java

@ -21,10 +21,10 @@ import org.springframework.aop.framework.autoproxy.AbstractBeanFactoryAwareAdvis @@ -21,10 +21,10 @@ import org.springframework.aop.framework.autoproxy.AbstractBeanFactoryAwareAdvis
import org.springframework.aop.support.ComposablePointcut;
import org.springframework.aop.support.DefaultPointcutAdvisor;
import org.springframework.aop.support.annotation.AnnotationMatchingPointcut;
import org.springframework.beans.factory.config.BeanPostProcessor;
/**
* A convenient {@link BeanPostProcessor} that applies {@link RetryAnnotationInterceptor}
* A convenient {@link org.springframework.beans.factory.config.BeanPostProcessor
* BeanPostProcessor} that applies {@link RetryAnnotationInterceptor}
* to all bean methods annotated with {@link Retryable} annotations.
*
* @author Juergen Hoeller

8
spring-aop/src/main/java/org/springframework/aop/retry/annotation/Retryable.java

@ -57,7 +57,7 @@ public @interface Retryable { @@ -57,7 +57,7 @@ public @interface Retryable {
Class<? extends Throwable>[] value() default {};
/**
* Applicable exceptions types to attempt a retry for. This attribute
* Applicable exception types to attempt a retry for. This attribute
* allows for the convenient specification of assignable exception types.
* <p>The default is empty, leading to a retry attempt for any exception.
* @see #excludes()
@ -67,7 +67,7 @@ public @interface Retryable { @@ -67,7 +67,7 @@ public @interface Retryable {
Class<? extends Throwable>[] includes() default {};
/**
* Non-applicable exceptions types to avoid a retry for. This attribute
* Non-applicable exception types to avoid a retry for. This attribute
* allows for the convenient specification of assignable exception types.
* <p>The default is empty, leading to a retry attempt for any exception.
* @see #includes()
@ -117,7 +117,7 @@ public @interface Retryable { @@ -117,7 +117,7 @@ public @interface Retryable {
* A multiplier for a delay for the next retry attempt, applied
* to the previous delay (starting with {@link #delay()}) as well
* as to the applicable {@link #jitterDelay()} for each attempt.
* <p>The default is 1.0, effectively leading to a fixed delay.
* <p>The default is 1.0, effectively resulting in a fixed delay.
* @see #delay()
* @see #jitterDelay()
* @see #maxDelay()
@ -127,7 +127,7 @@ public @interface Retryable { @@ -127,7 +127,7 @@ public @interface Retryable {
/**
* The maximum delay for any retry attempt (in milliseconds), limiting
* how far {@link #jitterDelay()} and {@link #delayMultiplier()} can
* increase {@link #delay()}.
* increase the {@linkplain #delay() delay}.
* <p>The default is unlimited.
* @see #delay()
* @see #jitterDelay()

10
spring-core/src/main/java/org/springframework/util/backoff/ExponentialBackOff.java

@ -61,25 +61,25 @@ import org.springframework.util.Assert; @@ -61,25 +61,25 @@ import org.springframework.util.Assert;
public class ExponentialBackOff implements BackOff {
/**
* The default initial interval: 2000 ms.
* The default initial interval: {@value} ms.
*/
public static final long DEFAULT_INITIAL_INTERVAL = 2000L;
/**
* The default jitter range for each interval: 0 ms.
* The default jitter range for each interval: {@value} ms.
* @since 7.0
*/
public static final long DEFAULT_JITTER = 0;
/**
* The default multiplier (increases the interval by 50%).
* The default multiplier (increases the interval by 50%): {@value}.
*/
public static final double DEFAULT_MULTIPLIER = 1.5;
/**
* The default maximum back-off time: 30000 ms.
* The default maximum back-off time: {@value} ms.
*/
public static final long DEFAULT_MAX_INTERVAL = 30000L;
public static final long DEFAULT_MAX_INTERVAL = 30_000L;
/**
* The default maximum elapsed time: unlimited.

Loading…
Cancel
Save