@@ -47,7 +47,21 @@ private RetryUtils() {
4747 */
4848 @ SafeVarargs
4949 public static Retry createRetry (String name , Class <? extends Throwable >... retryOnThrowables ) {
50- RetryConfig config = RetryConfig .from (DEFAULT_RETRY_CONFIG )
50+ return createRetry (name , DEFAULT_RETRY_CONFIG , retryOnThrowables );
51+ }
52+
53+ /**
54+ * Creates a retry instance with custom configuration for the specified throwable types.
55+ *
56+ * @param name the name for the retry instance
57+ * @param customConfig the custom retry configuration
58+ * @param retryOnThrowables the throwable classes to retry on
59+ * @return configured Retry instance
60+ */
61+ @ SafeVarargs
62+ public static Retry createRetry (String name , RetryConfig customConfig ,
63+ Class <? extends Throwable >... retryOnThrowables ) {
64+ RetryConfig config = RetryConfig .from (customConfig )
5165 .retryExceptions (retryOnThrowables )
5266 .build ();
5367
@@ -72,4 +86,20 @@ public static <T> Supplier<T> withRetry(Supplier<T> supplier, String name,
7286 Retry retry = createRetry (name , retryOnThrowables );
7387 return Retry .decorateSupplier (retry , supplier );
7488 }
89+
90+ /**
91+ * Decorates a supplier with custom retry logic for the specified throwable types.
92+ *
93+ * @param supplier the supplier to decorate
94+ * @param name the name for the retry instance
95+ * @param customConfig the custom retry configuration
96+ * @param retryOnThrowables the throwable classes to retry on
97+ * @return decorated supplier with retry logic
98+ */
99+ @ SafeVarargs
100+ public static <T > Supplier <T > withRetry (Supplier <T > supplier , String name , RetryConfig customConfig ,
101+ Class <? extends Throwable >... retryOnThrowables ) {
102+ Retry retry = createRetry (name , customConfig , retryOnThrowables );
103+ return Retry .decorateSupplier (retry , supplier );
104+ }
75105}
0 commit comments