Overview of Advanced Java 8 CompletableFuture Features (Part 2)

preview_player
Показать описание
This video provides a detailed summary of completion stage methods in the completable futures framework.
Рекомендации по теме
Комментарии
Автор

7:57 grouping CompletableFuture completion stage methods
8:41 based on: what you have to wait upon in order for the next completion stage to trigger to run
8:52 (wait for) a single previous stage, 2 previous stages (where both have to complete), either of two previous stages
9:38 methods triggered by a single previous stage completion - thenApply, thenCompose, thenAccept, thenRun
14:26 the async methods
18:16 *thenCompose*
19:43 example
15:00

ruixue
Автор

0:18 CompletionStage method
0:32 what it does: chain together actions
0:52 CompletableFuture can serve as a "completion stage" for processing the result of asynchronous computations
1:27 1:31 an action will be performed when an asynchronous action completes
1:52 example
4:08 *explanation* : register lambda actions to apply to perform when the previous stage completes successfully
4:19 a given action is only called when the action in the previous stage running asynchronously has finished and yielded the result
4:30 you can see these as: deferred computation that are registered with the framework to be *called back* when a previous stage completes
5:15 why we do all this stuff: 5:17 *completion stage* are valuable in CompletableFuture framework to *avoid blocking threads* until the results absolutely must be obtained
5:28 you really don't want to block unless you really really have to 5:32 *we don't want to block as a general rule of thumb*
5:35 consequence: 5:41 *try to avoid calling get() or join() unless you absolutely absolutely must*
6:34 *purpose: help improve responsiveness*

ruixue
Автор

@DouglasSchmidt at lower level, are the *blocking* and the *asynchronous waiting* by using those completion stage methods related to different states of the threads and thus their performance are significantly different? or is there any other reason according to the lower level implementation?

ruixue