helidon-microprofile-fault-tolerance not retrying method annotated with @Asynchronous
@Retry
on specific exception #8974
Closed
Description
After upgrading to helidon 4.x, helidon-microprofile-fault-tolerance
won't retry the method annotated with @Asynchronous
@Retry
on specific exception
Environment Details
- Helidon Version: 4.0.8
- Helidon SE or Helidon MP: MP
- JDK version: 21
- OS: MacOS
- Docker version (if applicable): Not Applicable
Problem Description
All the methods in sample below should be retried. However, only methods which have retryOn={Throwable.class}
and retryOn={Exception.class}
will be retried.
// this method will be retried in 4.x
@Asynchronous
@Retry(delay = 200, retryOn = {Throwable.class})
public CompletableFuture<String> willBeRetriedOnThrowable() {
logger.log(Level.INFO, "will be retried when retryOn={Throwable.class}");
return CompletableFuture.failedFuture(new CustomRuntimeException());
}
// this method will be retried in 4.x
@Asynchronous
@Retry(delay = 200, retryOn = {Exception.class})
public CompletableFuture<String> willBeRetriedOnException() {
logger.log(Level.INFO, "will be retried when retryOn={Exception.class}");
return CompletableFuture.failedFuture(new CustomRuntimeException());
}
// this method won't be retried in 4.x
@Asynchronous
@Retry(delay = 200, retryOn = {RuntimeException.class})
public CompletableFuture<String> wontBeRetriedOnRuntimeException() {
logger.log(Level.INFO, "won't be retried when retryOn={RuntimeException.class}");
return CompletableFuture.failedFuture(new CustomRuntimeException());
}
// this method won't be retried in 4.x
@Asynchronous
@Retry(delay = 200, retryOn = {CustomRuntimeException.class})
public CompletableFuture<String> wontBeRetriedOnActualException() {
logger.log(Level.INFO, "won't be retried when retryOn={CustomRuntimeException.class}");
return CompletableFuture.failedFuture(new CustomRuntimeException());
}
Steps to reproduce
- Download attached maven project, unzip and open in IDE
- Run org.example.Main.java
- Application log will verify some methods are not retried
OR
- Download attached maven project, unzip and build it with
mvn clean package
command - Then run application with
java -jar <jar-location>
command - Application log will verify some methods are not retried
Sample maven project showing the bug
Metadata
Assignees
Labels
Type
Projects
Status
Closed