Skip to content

Commit 308e840

Browse files
committed
0.5.2 release (adding supplyAsync / runAsync as CompletableTask root entry point)
1 parent 070738f commit 308e840

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<groupId>net.tascalate.concurrent</groupId>
66
<artifactId>net.tascalate.concurrent.lib</artifactId>
7-
<version>0.5.2-SNAPSHOT</version>
7+
<version>0.5.2</version>
88
<packaging>jar</packaging>
99

1010
<name>Tascalate Concurrenct</name>

src/test/java/net/tascalate/concurrent/J8Examples.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ public class J8Examples {
2424
public static void main(final String[] argv) throws InterruptedException, ExecutionException {
2525
final TaskExecutorService executorService = TaskExecutors.newFixedThreadPool(3);
2626

27+
CompletableTask
28+
.supplyAsync(() -> awaitAndProduceN(73), executorService)
29+
.thenAcceptAsync(J8Examples::onComplete)
30+
.get();
31+
2732
for (int i : Arrays.asList(5, -5, 10, 4)) {
2833
final Promise<Integer> task1 = executorService.submit(() -> awaitAndProduce1(i, 1500));
2934
final Promise<Integer> task2 = executorService.submit(() -> awaitAndProduce2(i + 1));
@@ -52,10 +57,10 @@ public static void main(final String[] argv) throws InterruptedException, Execut
5257
executorService.submit(() -> awaitAndProduceN(7)),
5358
executorService.submit(() -> awaitAndProduceN(8)),
5459
executorService.submit(() -> awaitAndProduceN(11))
55-
).thenApply(
60+
).thenApplyAsync(
5661
l -> l.stream().filter(v -> v != null).collect(Collectors.summingInt((Integer i) -> i.intValue()))
5762
)
58-
.thenAccept(J8Examples::onComplete)
63+
.thenAcceptAsync(J8Examples::onComplete)
5964
.exceptionally(J8Examples::onError);
6065

6166

0 commit comments

Comments
 (0)