File tree Expand file tree Collapse file tree 1 file changed +9
-6
lines changed
src/main/java/net/jodah/failsafe Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change 1717
1818import net .jodah .failsafe .internal .util .Assert ;
1919
20- import java .util .Arrays ;
20+ import java .util .ArrayList ;
21+ import java .util .Collections ;
2122import java .util .List ;
2223
2324/**
@@ -47,13 +48,15 @@ public class Failsafe {
4748 *
4849 * @param <R> result type
4950 * @param <P> policy type
50- * @throws NullPointerException if {@code policies} is null
51- * @throws IllegalArgumentException if {@code policies} is empty
51+ * @throws NullPointerException if {@code outermostPolicy} is null
5252 */
5353 @ SafeVarargs
54- public static <R , P extends Policy <R >> FailsafeExecutor <R > with (P ... policies ) {
55- Assert .notNull (policies , "policies" );
56- return new FailsafeExecutor <>(Arrays .asList (policies ));
54+ public static <R , P extends Policy <R >> FailsafeExecutor <R > with (P outermostPolicy , P ... policies ) {
55+ Assert .notNull (outermostPolicy , "outermostPolicy" );
56+ List <Policy <R >> policyList = new ArrayList <>(policies .length + 1 );
57+ policyList .add (outermostPolicy );
58+ Collections .addAll (policyList , policies );
59+ return new FailsafeExecutor <>(policyList );
5760 }
5861
5962 /**
You can’t perform that action at this time.
0 commit comments