Skip to content

Commit 8f3ca49

Browse files
committed
Rename Retryable.run() to Retryable.execute()
See gh-34716
1 parent d74b863 commit 8f3ca49

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

spring-core/src/main/java/org/springframework/core/retry/RetryTemplate.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
import org.springframework.util.backoff.FixedBackOff;
3333

3434
/**
35-
* A basic implementation of {@link RetryOperations} that invokes and potentially
35+
* A basic implementation of {@link RetryOperations} that executes and potentially
3636
* retries a {@link Retryable} operation based on a configured {@link RetryPolicy}
3737
* and {@link BackOff} policy.
3838
*
@@ -147,7 +147,7 @@ public void setRetryListener(RetryListener retryListener) {
147147
// Initial attempt
148148
try {
149149
logger.debug(() -> "Preparing to execute retryable operation '%s'".formatted(retryableName));
150-
R result = retryable.run();
150+
R result = retryable.execute();
151151
logger.debug(() -> "Retryable operation '%s' completed successfully".formatted(retryableName));
152152
return result;
153153
}
@@ -165,7 +165,7 @@ public void setRetryListener(RetryListener retryListener) {
165165
logger.debug(() -> "Preparing to retry operation '%s'".formatted(retryableName));
166166
try {
167167
this.retryListener.beforeRetry(retryExecution);
168-
R result = retryable.run();
168+
R result = retryable.execute();
169169
this.retryListener.onRetrySuccess(retryExecution, result);
170170
logger.debug(() -> "Retryable operation '%s' completed successfully after retry"
171171
.formatted(retryableName));

spring-core/src/main/java/org/springframework/core/retry/Retryable.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public interface Retryable<R> {
3636
* @return the result of the operation
3737
* @throws Throwable if an error occurs during the execution of the operation
3838
*/
39-
R run() throws Throwable;
39+
R execute() throws Throwable;
4040

4141
/**
4242
* A unique, logical name for this retryable operation, used to distinguish

spring-core/src/test/java/org/springframework/core/retry/RetryTemplateTests.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ void retryWithSuccess() throws Exception {
4444
int failure;
4545

4646
@Override
47-
public String run() throws Exception {
47+
public String execute() throws Exception {
4848
if (failure++ < 2) {
4949
throw new Exception("Error while invoking greeting service");
5050
}
@@ -68,7 +68,7 @@ void retryWithFailure() {
6868

6969
Retryable<String> retryable = new Retryable<>() {
7070
@Override
71-
public String run() throws Exception {
71+
public String execute() throws Exception {
7272
throw exception;
7373
}
7474

@@ -100,7 +100,7 @@ public TechnicalException(String message) {
100100

101101
Retryable<String> retryable = new Retryable<>() {
102102
@Override
103-
public String run() throws TechnicalException {
103+
public String execute() throws TechnicalException {
104104
throw technicalException;
105105
}
106106

0 commit comments

Comments
 (0)