JavaRush
AI Academy
new
Promotion
Learning
Courses
Tasks
Quizzes
Games
Help
Schedule of nudges
Internship
Community
Users
Forum
Chat
Articles
Activities
Reviews
Subscriptions
Light theme

Lectures

  • Reviews
  • About us
  • CS50
Start
Start learning
Start learning
  • My progress
  • Courses
  • Quest map
  • Lectures
  • Introduction to CompletableFuture

    JAVA 25 SELF
    55 level,0 lecture
    In this lecture we will examine why synchronous code leads to blocking, what limitations Future had (such as the blocking get()), and how the CompletableFuture class from the java.util.concurrent package changes the way we work with asynchrony. We will practice launching background tasks via supplyAsync, subscribing to results with thenAccept/ thenApply, discuss the role of the ForkJoinPool, and cover common pitfalls: using get()/ join() on the main thread, missing error handling via exceptionally/ handle, and more.
    Open
  • Asynchronous tasks: thenApply, thenAccept, thenRun

    JAVA 25 SELF
    55 level,1 lecture
    Breaking down launching and composing asynchronous computations with CompletableFuture: how to start tasks via supplyAsync and runAsync, how the handlers thenApply, thenAccept, thenRun differ, and when to choose their async versions thenApplyAsync/ thenAcceptAsync/ thenRunAsync. We’ll talk about execution threads ( ForkJoinPool or your Executor), result types ( CompletableFuture<T>, CompletableFuture<Void>) and common mistakes: blocking get()/ join(), unhandled errors without exceptionally/ handle/ whenComplete, and also trying to use the result inside thenRun.
    Open
  • Combining CompletableFuture: thenCombine, allOf, anyOf

    JAVA 25 SELF
    55 level,2 lecture
    How to parallelise tasks and merge results with CompletableFuture: combining two results via thenCombine/ thenCombineAsync, waiting for a set of tasks with allOf, reacting to the fastest response with anyOf. We’ll examine signatures, practical examples with supplyAsync, non-blocking handling ( thenAccept, thenRun), as well as error nuances and handling ( exceptionally, handle, whenComplete). At the end — a compact comparison table of the methods.
    Open
  • Error handling in asynchronous code: exceptionally, handle

    JAVA 25 SELF
    55 level,3 lecture
    How to safely catch and handle exceptions in CompletableFuture chains: we examine the roles of exceptionally (fallback value on error), handle (universal success/error handler), and whenComplete (side effects without changing the result). We will discuss why directly calling get()/ join() wraps causes in ExecutionException/ CompletionException, how to combine stages ( thenApply, thenAccept), and which common mistakes to avoid.
    Open
  • thenCompose + custom Executor + timeouts

    JAVA 25 SELF
    55 level,4 lecture
    How to properly “glue” asynchronous steps in CompletableFuture using thenCompose and when thenApply is sufficient; how and why to plug in your own thread pool via ExecutorService (instead of ForkJoinPool.commonPool()); how to protect chains from “waiting forever” using orTimeout and completeOnTimeout. At the end — a practical example with a custom Executor, thenCompose, and a timeout, plus typical mistakes and their fixes.
    Open
Courses
  • Java Course
  • Python Course
  • Development with Claude Code
  • All 16 courses
University
  • Java FullStack
  • Python FullStack
  • AI Native Developer
  • Web FullStack
Community
  • Articles
  • Forum
  • Help with Tasks
Company
  • About us
  • Contacts
  • Reviews
  • Pricing
  • Questions and answers
JavaRush JavaRush: online courses in Java and other programming languages, where you learn by solving tasks. We started in 2012 with a Java course, and today there are 16 courses: Java and Spring, Python, web development, SQL, Go, C#, C++, Kotlin, Swift, Docker and AI development. More than 10,000 tasks with instant checks, and the first level of any course is free. Learn on your own or with a mentor at JavaRush University.
Follow us
Язык интерфейса
Русский
English
Українська
"Programmers are not born" © 2026 JavaRush Terms of Use and Privacy policy
MastercardVisa
"Programmers are not born" © 2026 JavaRush Terms of Use and Privacy policy