Skip to content

Commit

Permalink
+ make defensive copy of CompletableFuture before scheduling clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
q3769 committed Sep 23, 2023
1 parent 37a9cf4 commit 4b992e2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>io.github.q3769</groupId>
<artifactId>conseq4j</artifactId>
<version>20230922.0.0</version>
<version>20230922.0.1</version>
<packaging>jar</packaging>
<name>conseq4j</name>
<description>A Java concurrent API to sequence related tasks while concurring unrelated ones</description>
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/conseq4j/execute/ConseqExecutor.java
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,10 @@ public <T> CompletableFuture<T> submit(@NonNull Callable<T> task, @NonNull Objec
(k, presentTask) -> (presentTask == null) ?
CompletableFuture.supplyAsync(() -> call(task), workerExecutorService) :
presentTask.handleAsync((r, e) -> call(task), workerExecutorService));
CompletableFuture<?> copy = latestTask.thenApply(r -> r);
latestTask.whenCompleteAsync((r, e) -> activeSequentialTasks.computeIfPresent(sequenceKey,
(k, checkedTask) -> checkedTask.isDone() ? null : checkedTask), adminService);
return (CompletableFuture<T>) latestTask.thenApply(r -> r);
return (CompletableFuture<T>) copy;
}

@Override
Expand Down

0 comments on commit 4b992e2

Please sign in to comment.