diff --git a/pom.xml b/pom.xml index 0506ff6..2e4c04a 100644 --- a/pom.xml +++ b/pom.xml @@ -27,7 +27,7 @@ 4.0.0 io.github.q3769 conseq4j - 20230922.0.0 + 20230922.0.1 jar conseq4j A Java concurrent API to sequence related tasks while concurring unrelated ones diff --git a/src/main/java/conseq4j/execute/ConseqExecutor.java b/src/main/java/conseq4j/execute/ConseqExecutor.java index 14d396b..439ba7f 100644 --- a/src/main/java/conseq4j/execute/ConseqExecutor.java +++ b/src/main/java/conseq4j/execute/ConseqExecutor.java @@ -146,9 +146,10 @@ public CompletableFuture submit(@NonNull Callable 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) latestTask.thenApply(r -> r); + return (CompletableFuture) copy; } @Override