File tree Expand file tree Collapse file tree 2 files changed +8
-2
lines changed
main/java/net/jodah/failsafe
test/java/net/jodah/failsafe Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change 3434 * Failsafe#with(Policy[])}.
3535 * <p>
3636 * Async executions are run by default on the {@link ForkJoinPool#commonPool()}. Alternative executors can be configured
37- * via {@link #with(ScheduledExecutorService)} and similar methods. All async executions are cancellable via the
38- * returned CompletableFuture, even those run by a {@link ForkJoinPool} or {@link CompletionStage}.
37+ * via {@link #with(ScheduledExecutorService)} and similar methods. All async executions are cancellable and
38+ * interruptable via the returned CompletableFuture, even those run by a {@link ForkJoinPool} or {@link CompletionStage}.
3939 *
4040 * @param <R> result type
4141 * @author Jonathan Halterman
Original file line number Diff line number Diff line change @@ -85,12 +85,18 @@ public static <T extends CircuitState> T stateFor(CircuitBreaker breaker) {
8585 }
8686 }
8787
88+ /**
89+ * Returns a future that is completed with the {@code result} on the {@code executor}.
90+ */
8891 public static CompletableFuture <Object > futureResult (ScheduledExecutorService executor , Object result ) {
8992 CompletableFuture <Object > future = new CompletableFuture <>();
9093 executor .schedule (() -> future .complete (result ), 0 , TimeUnit .MILLISECONDS );
9194 return future ;
9295 }
9396
97+ /**
98+ * Returns a future that is completed with the {@code exception} on the {@code executor}.
99+ */
94100 public static CompletableFuture <Object > futureException (ScheduledExecutorService executor , Exception exception ) {
95101 CompletableFuture <Object > future = new CompletableFuture <>();
96102 executor .schedule (() -> future .completeExceptionally (exception ), 0 , TimeUnit .MILLISECONDS );
You can’t perform that action at this time.
0 commit comments