arjun4084346 commented on code in PR #4001:
URL: https://github.com/apache/gobblin/pull/4001#discussion_r1679974324
##########
gobblin-utility/src/main/java/org/apache/gobblin/util/retry/RetryerFactory.java:
##########
@@ -104,32 +117,75 @@ public static <T> Retryer<T> newInstance(Config config,
Optional<RetryListener>
return builder.build();
}
+ /**
+ Retrieves a retry predicate based on the configuration provided. If the
configuration
+ does not specify any exceptions, a default retry predicate is returned.
+ *
+ @param config the configuration object containing the list of exception
class names
+ @return a Predicate that evaluates to true if the throwable should be
retried, false otherwise
+ */
+ @VisibleForTesting
+ public static Predicate<Throwable>
getRetryPredicateFromConfigOrDefault(Config config) {
+ // Retrieve the list of exception class names from the configuration
+ List<String> exceptionList = ConfigUtils.getStringList(config,
EXCEPTION_LIST_FOR_RETRY_CONFIG_KEY);
+
+ // If the exception list is null or empty, return the default retry
predicate
+ if (exceptionList == null || exceptionList.isEmpty()) {
Review Comment:
in this case, actually lets create a method `List<String>
getStringList(Config config, String path, List<String> def)` (taking idea from
the similar methods to get Int, String or other types) and then
`return ConfigUtils.getStringList(config,
EXCEPTION_LIST_FOR_RETRY_CONFIG_KEY, RETRY_EXCEPTION_PREDICATE_DEFAULT);`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]