Back to the CompletableFuture: Concurrency in Action
summary
Explains why plain Future fails (blocking get, no chaining, awkward exception handling) and shows concrete tools to stop using raw Threads: use ThreadLocal for per-thread SimpleDateFormat, AtomicLong for lock‑free counters, ConcurrentHashMap plus putIfAbsent for safe caches, and ExecutorService thread pools (single, cached, fixed, scheduled, work‑stealing). Demonstrates CompletableFuture features: supplyAsync with custom executor, thenCompose for flat mapping, thenCombine for merging results, allOf/anyOf and exceptionally/handle, plus complete/timeout control.
AI-written summary · about
chapters (38)
- 0:00Intro
- 1:37Goals
- 2:33Motivation
- 4:54Thread Safety
- 6:24Concurrency & Sharks
- 7:11Agenda Single Threading
- 9:56Programming by Coincidence
- 10:40Design by Contract
- 11:19Temporal Coupling
- 12:05Multithreading Forms Concurrent Form
- 12:26Form: Concurrency Multiple Tasks
- 14:53Form: Parallelism Fire & Forget
- 15:46Form: Asynchrony
- 16:38Runnable No Input
- 17:13Thread Runnable Based
- 18:19ThreadLocal Resource Confinement
- 19:36Atomic Operations Compound
- 21:29Thread Safe Collections Compound Operations
- 23:16Promises in JavaScript
- 23:48Callback Hell in JavaScript Verbose
- 26:18Future Completed in the Future
- 27:23Executor Framework Thread Management
- 28:16Thread Pool Thread Management
- 28:46Executor Factories
- 30:25Executor Service
- 31:31Blocking Result Retrievar Blocking Get
- 31:59Futures Chaining No Workflows
- 32:47Futures Combination Blocking InvokeAny
- 33:25Exception Handling Multiple Exceptions
- 34:07CompletableFuture Transformation
- 34:46Blocking Operations
- 35:00Transformation/Chaining Workflows
- 36:17Tasks Composition
- 38:00Controllable Futures
- 39:03Multiple Futures Control
- 40:06Tasks Combination Collect Results
- 41:49Embrace Concurrency
- 42:15Embrace Review Your Concurrency Application
related talks
28mBack to the CompletableFuture: Concurrency
34mConcurrency in Spring Boot Applications: Making the Right Choice
50mThinkAsync in Java8
52mNew Concurrency Utilities in Java 8
48mParallel Streams, CompletableFuture, and All That: Concurrency in Java 8
02h 35mParallel and Asynchronous Programming with Streams and CompletableFuture
48mCompletableFuture: The Promises of Java
50mFlavors of Concurrency in Java
