/** * Creates new instance of retryer based on the config. * Accepted config keys are defined in RetryerFactory as static member variable. * You can use State along with ConfigBuilder and config prefix to build config. * * @param config * @return */ public static <T> Retryer<T> newInstance(Config config) { config = config.withFallback(DEFAULTS); RetryType type = RetryType.valueOf(config.getString(RETRY_TYPE).toUpperCase()); switch (type) { case EXPONENTIAL: return newExponentialRetryer(config); case FIXED: return newFixedRetryer(config); default: throw new IllegalArgumentException(type + " is not supported"); } }
/** * Creates new instance of retryer based on the config. * Accepted config keys are defined in RetryerFactory as static member variable. * You can use State along with ConfigBuilder and config prefix to build config. * * @param config * @return */ public static <T> Retryer<T> newInstance(Config config) { config = config.withFallback(DEFAULTS); RetryType type = RetryType.valueOf(config.getString(RETRY_TYPE).toUpperCase()); switch (type) { case EXPONENTIAL: return newExponentialRetryer(config); case FIXED: return newFixedRetryer(config); default: throw new IllegalArgumentException(type + " is not supported"); } }