Timeouts and cancellation
On This Lesson 4 topics
This lesson is planned. The outline below lists the topics it will cover. The full lesson has not been published yet.
In this lesson
bound waiting time.
Planned topics
orTimeout(d, unit)fails withTimeoutException;completeOnTimeout(value, d, unit)supplies a default (Java 9+).cancel(true)on aCompletableFuturedoes not interrupt the running task; design tasks to check for cancellation.- Apply a deadline to the whole fan-out and per-call timeouts to each.
- A timeout does not stop the remote work; pair with client-side timeouts.
- Combine: timeout then fallback.
Draft outline details
Demonstration
reviews.completeOnTimeout(List.of(), 300, TimeUnit.MILLISECONDS);Check your understanding
Does cancel(true) interrupt the thread in a CompletableFuture?
Show answer
No.
Practice
Apply this lesson with the module's lab, exercises and quiz.
Marking a lesson complete is optional and you can undo it any time. Your progress stays in this browser.