82
82
*
83
83
* @author Aleksandr Shamukov
84
84
* @author Artem Bilan
85
+ * @author Kim In Hoi
85
86
* @since 1.3
86
87
*/
87
88
public class RetryTemplateBuilder {
@@ -276,7 +277,7 @@ public RetryTemplateBuilder customBackoff(BackOffPolicy backOffPolicy) {
276
277
* <p>
277
278
* You should select the way you want to configure exception classifier: white list or
278
279
* black list. If you choose white list - use this method, if black - use
279
- * {@link #notRetryOn(Class)}
280
+ * {@link #notRetryOn(Class)} or {@link #notRetryOn(List)}
280
281
* @param throwable to be retryable (with it's subclasses)
281
282
* @return this
282
283
* @see BinaryExceptionClassifierBuilder#retryOn
@@ -295,7 +296,7 @@ public RetryTemplateBuilder retryOn(Class<? extends Throwable> throwable) {
295
296
* <p>
296
297
* You should select the way you want to configure exception classifier: white list or
297
298
* black list. If you choose black list - use this method, if white - use
298
- * {@link #retryOn(Class)}
299
+ * {@link #retryOn(Class)} or {@link #retryOn(List)}
299
300
* @param throwable to be not retryable (with it's subclasses)
300
301
* @return this
301
302
* @see BinaryExceptionClassifierBuilder#notRetryOn
@@ -306,6 +307,50 @@ public RetryTemplateBuilder notRetryOn(Class<? extends Throwable> throwable) {
306
307
return this ;
307
308
}
308
309
310
+ /**
311
+ * Add all throwables to the while list of retryable exceptions.
312
+ * <p>
313
+ * Warn: touching this method drops default {@code retryOn(Exception.class)} and you
314
+ * should configure whole classifier from scratch.
315
+ * <p>
316
+ * You should select the way you want to configure exception classifier: white list or
317
+ * black list. If you choose white list - use this method, if black - use
318
+ * {@link #notRetryOn(Class)} or {@link #notRetryOn(List)}
319
+ * @param throwables to be retryable (with it's subclasses)
320
+ * @return this
321
+ * @since 1.3.2
322
+ * @see BinaryExceptionClassifierBuilder#retryOn
323
+ * @see BinaryExceptionClassifier
324
+ */
325
+ public RetryTemplateBuilder retryOn (List <Class <? extends Throwable >> throwables ) {
326
+ for (final Class <? extends Throwable > throwable : throwables ) {
327
+ classifierBuilder ().retryOn (throwable );
328
+ }
329
+ return this ;
330
+ }
331
+
332
+ /**
333
+ * Add all throwables to the black list of retryable exceptions.
334
+ * <p>
335
+ * Warn: touching this method drops default {@code retryOn(Exception.class)} and you
336
+ * should configure whole classifier from scratch.
337
+ * <p>
338
+ * You should select the way you want to configure exception classifier: white list or
339
+ * black list. If you choose black list - use this method, if white - use
340
+ * {@link #retryOn(Class)} or {@link #retryOn(List)}
341
+ * @param throwables to be not retryable (with it's subclasses)
342
+ * @return this
343
+ * @since 1.3.2
344
+ * @see BinaryExceptionClassifierBuilder#notRetryOn
345
+ * @see BinaryExceptionClassifier
346
+ */
347
+ public RetryTemplateBuilder notRetryOn (List <Class <? extends Throwable >> throwables ) {
348
+ for (final Class <? extends Throwable > throwable : throwables ) {
349
+ classifierBuilder ().notRetryOn (throwable );
350
+ }
351
+ return this ;
352
+ }
353
+
309
354
/**
310
355
* Suppose throwing a {@code new MyLogicException(new IOException())}. This template
311
356
* will not retry on it: <pre>{@code
0 commit comments