Package io.smallrye.faulttolerance.api
Interface BeforeRetryHandler
- All Known Implementing Classes:
BeforeRetry.DEFAULT
public interface BeforeRetryHandler
For each retry attempt, a new instance of the handler is created by the CDI container.
The instance is created before the
handle(ExecutionContext) method is called,
and after it finishes, the instance is destroyed. The implementation class can declare
injection points, lifecycle callbacks and so on.
Usage
@ApplicationScoped
public class MyService {
@Inject
OtherService otherService;
@Retry
@BeforeRetry(MyBeforeRetry.class)
String doSomething() {
return otherService.hello();
}
}
public class MyBeforeRetry implements BeforeRetryHandler {
@Inject
OtherService otherService;
void handle(ExecutionContext context) {
otherService.reset();
}
}
-
Method Summary
Modifier and TypeMethodDescriptionvoidhandle(org.eclipse.microprofile.faulttolerance.ExecutionContext context) Do what is necessary before the next retry attempt.
-
Method Details
-
handle
void handle(org.eclipse.microprofile.faulttolerance.ExecutionContext context) Do what is necessary before the next retry attempt.- Parameters:
context- the execution context
-