Parallel Streams, CompletableFuture, and All That: Concurrency in Java 8
summary
Covers concrete Java 8 and 9 techniques: parallel streams backed by the ForkJoinPool common pool (size from Runtime.getRuntime().availableProcessors plus one), CompletableFuture coordination including complete and completeExceptionally and CompletableFuture.supplyAsync, and ExecutorService overrides. Gives JMH benchmarks showing parallel wins only when operations are independent associative and n×Q passes a threshold, demos a real app that downloads MLB box_score.json with OkHttp JSoup and Gson, saves files, handles rainouts, and works end to end when the Wi Fi cooperates.
AI-written summary · about
chapters (28)
- 0:00Introduction
- 0:46About Ken
- 1:42Modern Java Recipes
- 3:04Safari Books
- 3:15Definitions
- 4:09Simple Made Easy
- 5:59Brian Gets
- 7:16Factory Methods
- 8:25Parallel and Sequential
- 9:19Part of a Pipeline
- 9:53Sequential Parallel Tests
- 13:01When is Parallel Worth Doing
- 15:34Partitioning
- 16:41Demonstration
- 18:17Fork Join Pool
- 24:48Change Threads
- 26:35Future
- 27:57Busy Waiting
- 28:35CompletableFuture
- 32:01Methods
- 33:34Combined Methods
- 33:58Overloads
- 34:12Async
- 34:53Overload
- 35:55Supply Async
- 36:26Get and Join
- 37:34Wait quiescence
- 41:41Example
related talks
02h 35mParallel and Asynchronous Programming with Streams and CompletableFuture
50mThinkAsync in Java8
52mNew Concurrency Utilities in Java 8
28mBack to the CompletableFuture: Concurrency
47mA Deeper Dive into Java Concurrency Updates
56mFlavors of Concurrency in Java
55mBack to the CompletableFuture: Concurrency in Action
50mFlavors of Concurrency in Java
