diff --git a/spring-core/src/main/java/org/springframework/core/retry/RetryException.java b/spring-core/src/main/java/org/springframework/core/retry/RetryException.java index eae4859afa8..694cd04465b 100644 --- a/spring-core/src/main/java/org/springframework/core/retry/RetryException.java +++ b/spring-core/src/main/java/org/springframework/core/retry/RetryException.java @@ -22,6 +22,11 @@ import java.util.Objects; /** * Exception thrown when a {@link RetryPolicy} has been exhausted. * + *
A {@code RetryException} will contain the last exception thrown by the + * {@link Retryable} operation as the {@linkplain #getCause() cause} and any + * exceptions from previous attempts as {@linkplain #getSuppressed() suppressed + * exceptions}. + * * @author Mahmoud Ben Hassine * @since 7.0 * @see RetryOperations diff --git a/spring-core/src/main/java/org/springframework/core/retry/RetryOperations.java b/spring-core/src/main/java/org/springframework/core/retry/RetryOperations.java index d69b1570d19..d125cb5f620 100644 --- a/spring-core/src/main/java/org/springframework/core/retry/RetryOperations.java +++ b/spring-core/src/main/java/org/springframework/core/retry/RetryOperations.java @@ -34,15 +34,17 @@ import org.jspecify.annotations.Nullable; public interface RetryOperations { /** - * Execute the given {@link Retryable} (according to the {@link RetryPolicy} - * configured at the implementation level) until it succeeds, or eventually - * throw an exception if the {@code RetryPolicy} is exhausted. + * Execute the given {@link Retryable} operation according to the {@link RetryPolicy} + * configured at the implementation level. + *
If the {@code Retryable} succeeds, its result will be returned. Otherwise, a
+ * {@link RetryException} will be thrown to the caller. The {@code RetryException}
+ * will contain the last exception thrown by the {@code Retryable} operation as the
+ * {@linkplain RetryException#getCause() cause} and any exceptions from previous
+ * attempts as {@linkplain RetryException#getSuppressed() suppressed exceptions}.
* @param retryable the {@code Retryable} to execute and retry if needed
* @param If the {@code Retryable} succeeds, its result will be returned. Otherwise,
- * a {@link RetryException} will be thrown to the caller.
+ * Execute the supplied {@link Retryable} operation according to the configured
+ * {@link RetryPolicy}.
+ * If the {@code Retryable} succeeds, its result will be returned. Otherwise, a
+ * {@link RetryException} will be thrown to the caller. The {@code RetryException}
+ * will contain the last exception thrown by the {@code Retryable} operation as the
+ * {@linkplain RetryException#getCause() cause} and any exceptions from previous
+ * attempts as {@linkplain RetryException#getSuppressed() suppressed exceptions}.
* @param retryable the {@code Retryable} to execute and retry if needed
* @param