~/talk

Back to the CompletableFuture: Concurrency in Action

Talkat JCON-ONLINE 2021 · 2021-10-05..10-08· [java, concurrency]
slides:none on file

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

  1. 0:00Intro
  2. 1:37Goals
  3. 2:33Motivation
  4. 4:54Thread Safety
  5. 6:24Concurrency & Sharks
  6. 7:11Agenda Single Threading
  7. 9:56Programming by Coincidence
  8. 10:40Design by Contract
  9. 11:19Temporal Coupling
  10. 12:05Multithreading Forms Concurrent Form
  11. 12:26Form: Concurrency Multiple Tasks
  12. 14:53Form: Parallelism Fire & Forget
  13. 15:46Form: Asynchrony
  14. 16:38Runnable No Input
  15. 17:13Thread Runnable Based
  16. 18:19ThreadLocal Resource Confinement
  17. 19:36Atomic Operations Compound
  18. 21:29Thread Safe Collections Compound Operations
  19. 23:16Promises in JavaScript
  20. 23:48Callback Hell in JavaScript Verbose
  21. 26:18Future Completed in the Future
  22. 27:23Executor Framework Thread Management
  23. 28:16Thread Pool Thread Management
  24. 28:46Executor Factories
  25. 30:25Executor Service
  26. 31:31Blocking Result Retrievar Blocking Get
  27. 31:59Futures Chaining No Workflows
  28. 32:47Futures Combination Blocking InvokeAny
  29. 33:25Exception Handling Multiple Exceptions
  30. 34:07CompletableFuture Transformation
  31. 34:46Blocking Operations
  32. 35:00Transformation/Chaining Workflows
  33. 36:17Tasks Composition
  34. 38:00Controllable Futures
  35. 39:03Multiple Futures Control
  36. 40:06Tasks Combination Collect Results
  37. 41:49Embrace Concurrency
  38. 42:15Embrace Review Your Concurrency Application
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.