Skip to content

Commit

Permalink
Minor javadoc fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jhalterman committed Sep 4, 2023
1 parent e6124a7 commit 7f6f31f
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions core/src/main/java/dev/failsafe/internal/FallbackExecutor.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ public FallbackExecutor(FallbackImpl<R> fallback, int policyIndex) {
}

/**
* Performs an execution by calling pre-execute else calling the supplier, applying a fallback if it fails, and
* calling post-execute.
* Performs an execution by applying the {@code innerFn}, applying a fallback if it fails, and calling post-execute.
*/
@Override
public Function<SyncExecutionInternal<R>, ExecutionResult<R>> apply(
Expand Down Expand Up @@ -70,7 +69,8 @@ public Function<SyncExecutionInternal<R>, ExecutionResult<R>> apply(
}

/**
* Performs an async execution by calling pre-execute else calling the supplier and doing a post-execute.
* Performs an async execution by applying the {@code innerFn}, applying a fallback if it fails, and calling
* post-execute.
*/
@Override
public Function<AsyncExecutionInternal<R>, CompletableFuture<ExecutionResult<R>>> applyAsync(
Expand All @@ -91,11 +91,13 @@ public Function<AsyncExecutionInternal<R>, CompletableFuture<ExecutionResult<R>>
CompletableFuture<ExecutionResult<R>> promise = new CompletableFuture<>();
Callable<R> callable = () -> {
try {
CompletableFuture<R> fallbackFuture = fallback.applyStage(result.getResult(), result.getException(), execution);
CompletableFuture<R> fallbackFuture = fallback.applyStage(result.getResult(), result.getException(),
execution);
fallbackFuture.whenComplete((innerResult, exception) -> {
if (exception instanceof CompletionException)
exception = exception.getCause();
ExecutionResult<R> r = exception == null ? result.withResult(innerResult) : ExecutionResult.exception(exception);
ExecutionResult<R> r =
exception == null ? result.withResult(innerResult) : ExecutionResult.exception(exception);
promise.complete(r);
});
} catch (Throwable t) {
Expand Down

0 comments on commit 7f6f31f

Please sign in to comment.