if (includes.length == 0) {
includes = retryable.include();
}
Class<? extends Throwable>[] excludes = retryable.exclude();
if (includes.length == 0 && excludes.length == 0) {
SimpleRetryPolicy simple = new SimpleRetryPolicy();
simple.setMaxAttempts(retryable.maxAttempts());
return simple;
}
Map<Class<? extends Throwable>, Boolean> policyMap = new HashMap<Class<? extends Throwable>, Boolean>();
for (Class<? extends Throwable> type : includes) {
policyMap.put(type, true);
}
for (Class<? extends Throwable> type : excludes) {
policyMap.put(type, false);
}
return new SimpleRetryPolicy(retryable.maxAttempts(), policyMap, true);
}