public class NonTransientExceptionClassesPredicate extends Object implements Predicate<Throwable>
RetryScheduler
implementations like in the following example:
IntervalRetryScheduler myRetryScheduler = IntervalRetryScheduler .builder() .retryExecutor(new ScheduledThreadPoolExecutor(1)) .nonTransientFailurePredicate( new NonTransientExceptionClassesPredicate( AxonNonTransientException.class, NullPointerException.class, IllegalArgumentException.class, IllegalStateException.class ) ) .build();
Constructor and Description |
---|
NonTransientExceptionClassesPredicate(Class<? extends Throwable>... nonTransientFailures)
Initialize the predicate with class(es) that are considered as non-transient.
|
Modifier and Type | Method and Description |
---|---|
protected List<Class<? extends Throwable>> |
getNonTransientFailures()
Fetches a configured list of non-transient failures.
|
protected boolean |
isNonTransientFailure(Throwable failure)
Checks if the provided
failure is considered non-transient. |
boolean |
test(Throwable failure) |
@SafeVarargs public NonTransientExceptionClassesPredicate(Class<? extends Throwable>... nonTransientFailures)
nonTransientFailures
- vararg list of non-transient class(es)protected boolean isNonTransientFailure(Throwable failure)
failure
is considered non-transient.
This implementation checks if any configured exception class is assignable to the provided failure.failure
- The failure to check for non-transiencytrue
) or not (false
)protected List<Class<? extends Throwable>> getNonTransientFailures()
isNonTransientFailure(Throwable)
.Copyright © 2010–2023. All rights reserved.