Using Java CompletionStage in Asynchronous Programming
summary
Shows concrete code wiring java.util.concurrent.CompletionStage and CompletableFuture into ADBA via the AOJ implementation, using supplyAsync/thenRunAsync to execute queries off the caller thread and thenCompose/thenComposeAsync to splice functions that return CompletionStage. Demonstrates a real submit implementation where moreRows builds repeated composed futures to fetch and process batches of rows. AOJ is a blocking proof‑of‑concept over JDBC so it works but does not scale; advice is to use CompletionStage API, not subclass CompletableFuture.
AI-written summary · about
chapters (20)
- 0:00Introduction
- 1:10What is CompletionStage
- 4:06Example
- 9:34DBA Code
- 11:48DBA Over JDBC
- 13:33Aoj Implementation
- 15:03Submit Implementation
- 17:27Handle Implementation
- 18:51Follows
- 20:52Compose
- 23:25Execute
- 24:45HandleRows
- 27:25MoreRows
- 30:29Summary
- 33:17Using a DBA
- 34:56Using compose
- 37:51DBAs
- 39:04More Rows
- 41:25Processing Exceptions
- 43:25Conclusion
related talks
26mReactive Java Programming: a new Asynchronous Database...
48mParallel Streams, CompletableFuture, and All That: Concurrency in Java 8
28mBack to the CompletableFuture: Concurrency
50mThinkAsync in Java8
47mA Deeper Dive into Java Concurrency Updates
55mBack to the CompletableFuture: Concurrency in Action
52mNew Concurrency Utilities in Java 8
02h 35mParallel and Asynchronous Programming with Streams and CompletableFuture
