Skip to content

Commit 8475833

Browse files
authored
Update ARTICLE1.md
1 parent 78b019c commit 8475833

File tree

1 file changed

+2
-15
lines changed

1 file changed

+2
-15
lines changed

ARTICLE1.md

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -263,20 +263,7 @@ Promise<List<String>> resultPromise = CompletableTask
263263
;
264264
```
265265

266-
Moreover, in the _original_ example only the call to the `thenCombineAsync` will be cancelled on timeout (the last in the chain), to cancel the whole chain please use the functionality of the `DependentPromise` interface (will be discussed later):
267-
```java
268-
Executor myExecutor = ...; // Get an executor
269-
Promise<String> parallelPromise = CompletableTask
270-
.supplyAsync( () -> someLongRunningDbCall(), executor );
271-
Promise<List<String>> resultPromise = CompletableTask
272-
.supplyAsync( () -> someLongRunningIoBoundMehtod(), executor )
273-
.dependent()
274-
// enlist promise of someLongRunningIoBoundMehtod for cancellation
275-
.thenApplyAsync( v -> converterMethod(), true )
276-
// enlist result of thenApplyAsync and parallelPromise for cancellation
277-
.thenCombineAsync(parallelPromise, (u, v) -> Arrays.asList(u, v), PromiseOrigin.ALL)
278-
.orTimeout( Duration.ofSeconds(5) ); // now timeout will cancel the whole chain
279-
```
266+
Moreover, in the _original_ example only the call to the `thenCombineAsync` will be cancelled on timeout (the last in the chain), to cancel the whole chain it's necessary to use a functionality of the `DependentPromise` interface (will be discussed in next article).
280267

281268
Another useful timeout-related methods declared in `Promise` interface are:
282269
```java
@@ -398,5 +385,5 @@ The `Promise` returned has the following characteristics:
398385

399386
# Acknowledgements
400387

401-
Internal implementation details are greatly inspired [by the work](https://github.com/lukas-krecan/completion-stage) done by [Lukáš Křečan](https://github.com/lukas-krecan). The part of the polling / asynchronous retry functionality is adopted from the [async-retry](https://github.com/nurkiewicz/async-retry) library by [Tomasz Nurkiewicz](http://nurkiewicz.com/)
388+
Internal implementation details of the `CompletableTask` hierarchy are greatly inspired [by the work](https://github.com/lukas-krecan/completion-stage) done by [Lukáš Křečan](https://github.com/lukas-krecan). A description of his library is available as a two-part article on DZone: [Part 1](https://dzone.com/articles/implementing-java-8) and [Part II](https://dzone.com/articles/implementing-java-8-0). It's a worth reading for those, who'd like to have better understanding of the `CompletableTask` internals.
402389

0 commit comments

Comments
 (0)