~/talk

CompletableFuture: The Promises of Java

Talkat Oracle Code One 2018 · 2018-10-22..10-25· [concurrency]
slides:none on file

CompletableFuture is Java’s equivalent of JavaScript promises: use supplyAsync to run compute in the ForkJoin common pool or pass a custom pool, chain transformations with thenApply, consume with thenAccept and side‑effects with thenRun, recover with exceptionally or handle, and fault with completeExceptionally. Java 9 adds completeOnTimeout/orTimeout so futures don’t live‑lock; examples show 2 → thenApply(x*2) → thenApply(+1) = 5 and a recovery that returns 100 producing 201 when composed. Always pick a timeout strategy.

AI-written summary · about

  1. 0:00Introduction
  2. 1:00What is a Promise
  3. 2:00Promise Tracks
  4. 5:00Stages
  5. 8:00Create Method
  6. 9:00Print Method
  7. 10:00Nonblocking
  8. 13:00Custom pools
  9. 14:00Methods
  10. 18:00Keep on going
  11. 20:00ThenApply
  12. 24:00Pipeline
  13. 25:00Unhappy Path
  14. 29:00Something Went Wrong
  15. 30:00Runtime Exception
  16. 32:00Deficiencies
  17. 34:00Timeout
  18. 35:00Sleep
  19. 39:00Time Out
  20. 40:00Blow Up
  21. 41:00Combine
  22. 43:00Reduce
  23. 44:00Combined
  24. 45:00One to Many
  25. 46:00Map vs Flat Map
~/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.