@ -34,15 +34,17 @@ import org.jspecify.annotations.Nullable;
@@ -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 .
* < p > 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 < R > the type of the result
* @return the result of the { @code Retryable } , if any
* @throws RetryException if the { @code RetryPolicy } is exhausted ; exceptions
* encountered during retry attempts should be made available as suppressed
* exceptions
* @throws RetryException if the { @code RetryPolicy } is exhausted
* /
< R > @Nullable R execute ( Retryable < ? extends @Nullable R > retryable ) throws RetryException ;