Package io.smallrye.faulttolerance.api
Annotation Type RetryWhen
-
@Inherited @Documented @Retention(RUNTIME) @Target({METHOD,TYPE}) @Experimental("first attempt at providing predicate-based retries") public @interface RetryWhen
Modifies a@Retryannotation to retry when given predicate returnstrue. May only be present on elements that are also annotated@Retry. If this annotation is present and the@RetryWhen.exceptionmember is set, the@Retry.retryOnand@Retry.abortOnmembers must not be set.For each usage of the
@RetryWhenannotation, all givenPredicates are instantiated once. The predicate classes must have apublic, zero-parameter constructor. They must be thread-safe, ideally stateless.- See Also:
exception(),result()
-
-
Optional Element Summary
Optional Elements Modifier and Type Optional Element Description Class<? extends Predicate<Throwable>>exceptionClass of the predicate that will be used to determine whether the action should be retried if the action has thrown an exception.Class<? extends Predicate<Object>>resultClass of the predicate that will be used to determine whether the action should be retried if the action has returned a result.
-
-
-
Element Detail
-
result
Class<? extends Predicate<Object>> result
Class of the predicate that will be used to determine whether the action should be retried if the action has returned a result.Even if the guarded action is asynchronous, the predicate takes a produced result. The predicate is never passed a
CompletionStageor so.- Returns:
- predicate class
- Default:
- io.smallrye.faulttolerance.api.NeverOnResult.class
-
-
-
exception
Class<? extends Predicate<Throwable>> exception
Class of the predicate that will be used to determine whether the action should be retried if the action has thrown an exception.Even if the guarded action is asynchronous, the predicate takes a produced exception. The predicate is never passed a
CompletionStageor so.- Returns:
- predicate class
- Default:
- io.smallrye.faulttolerance.api.AlwaysOnException.class
-
-