Skip to content

Commit e126efb

Browse files
FailsafeFuture: clear execution after completion (#362)
This should fix result futures strongly retaining their computing functions
1 parent be89177 commit e126efb

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

core/src/main/java/dev/failsafe/spi/FailsafeFuture.java

+4
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ public synchronized boolean cancel(boolean mayInterruptIfRunning) {
8181
ExecutionResult<R> result = ExecutionResult.exception(new CancellationException());
8282
super.completeExceptionally(result.getException());
8383
completionHandler.accept(result, newestExecution);
84+
newestExecution = null;
85+
cancelFunctions = null;
8486
return cancelResult;
8587
}
8688

@@ -99,6 +101,8 @@ public synchronized boolean completeResult(ExecutionResult<R> result) {
99101
completed = super.completeExceptionally(exception);
100102
if (completed)
101103
completionHandler.accept(result, newestExecution);
104+
newestExecution = null;
105+
cancelFunctions = null;
102106
return completed;
103107
}
104108

0 commit comments

Comments
 (0)