Skip to content

Commit

Permalink
FailsafeFuture: clear execution after completion (#362)
Browse files Browse the repository at this point in the history
This should fix result futures strongly retaining their computing functions
  • Loading branch information
stevenschlansker committed Mar 20, 2023
1 parent be89177 commit e126efb
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions core/src/main/java/dev/failsafe/spi/FailsafeFuture.java
Expand Up @@ -81,6 +81,8 @@ public synchronized boolean cancel(boolean mayInterruptIfRunning) {
ExecutionResult<R> result = ExecutionResult.exception(new CancellationException());
super.completeExceptionally(result.getException());
completionHandler.accept(result, newestExecution);
newestExecution = null;
cancelFunctions = null;
return cancelResult;
}

Expand All @@ -99,6 +101,8 @@ public synchronized boolean completeResult(ExecutionResult<R> result) {
completed = super.completeExceptionally(exception);
if (completed)
completionHandler.accept(result, newestExecution);
newestExecution = null;
cancelFunctions = null;
return completed;
}

Expand Down

0 comments on commit e126efb

Please sign in to comment.