O'Reilly logo
live online training icon Live Online training

Reactive Programming with Java 8 Completable Futures

Douglas Schmidt

Attendees in this course will learn how to develop efficient reactive programs that run scalably on multi-core processors using powerful object-oriented and functional programming language features and concurrency frameworks supported by Java 8. This live online training focuses on how Java 8 leverages its functional programming features to create the completable futures framework. This framework defines a powerful reactive programming model that runs multiple asynchronous operations concurrently in a pool of threads and processes their results concurrently.

This course assumes working knowledge of Java 8 Lambdas and Streams. We recommend taking the first course in this series if you require that training.

Course series:

  • Programming with Java 8 Lambdas and Streams – Java 8 Concurrency Series, Part 1
  • Scalable Programming with the Java 8 Parallel Streams – Java 8 Concurrency Series, Part 2
  • Reactive Programming with the Java 8 Completable Futures – Java 8 Concurrency Series, Part 3

What you'll learn-and how you can apply it

  • Develop efficient reactive programs using powerful Java 8 object-oriented and functional programming language features and the completable futures framework.
  • Recognize the inherent and accidental complexities involved with using completable futures to develop reactive software for Java 8 clients and servers.
  • Understand how common software patterns and the Java 8 completable futures framework can and cannot help to alleviate this complexity.
  • Know where to find additional sources of information on how to successfully develop robust reactive programs using Java 8 completable futures.

This training course is for you because...

  • For software developers creating scalable apps on modern multi-core processors in Java.

Prerequisites

This training is intended for software developers who are familiar with:

  • General object-oriented design and programming concepts, such as encapsulation, abstraction, polymorphism, extensibility, and the Unified Modeling Language (UML),
  • Core object-oriented programming language features, such as classes, inheritance, dynamic binding, and generics, that are available in Java
  • Core functional programming features, such as lambda expressions, method references, and functional interfaces, that are available in Java 8, and
  • Core Java 8 sequential streams features, such as intermediate operations (e.g., map(), filter(), and flatMap()) and terminal operations (e.g., collect() and reduce())
  • Core functional programming features and Java 8 sequential streams are covered in another Live Training course entitled Programming with Java 8 Lambdas and Streams
  • Need to know how to download and install the Java 8 JDK and JRE
  • Need to know how to download and install an IDE, such as IntelliJ, NetBeans, Eclipse, or Android Studio

Materials, downloads, or Supplemental Content needed in advance:

An installed copy of the Java 8 JDK and JRE

An installed copy of IntelliJ, NetBeans, Eclipse, or Android Studio

Resources:

LiveLessons: Java Concurrency (2nd edition) (video)

LiveLessons: Design Patterns in Java (video)

About your instructor

Schedule

The timeframes are only estimates and may vary according to how the class is progressing

Segment 1 Motivating Reactive Programming and the Need for Java 8 Completable Futures (20mins)

  • Instructor will explain the key precepts of the reactive programming paradigm, explain the difference between synchronous and asynchronous operations, and motivate the need for Java 8 completable futures by showing why Java futures available in earlier versions of Java provide an overly limited approach to asynchrony.
  • Participants will learn how earlier versions of Java provide limited support for asynchrony, both in terms of scalability and programmability.

Segment 2 Introduction to Java 8 Completable Futures (35mins)

  • Instructor will describe the key concepts and basic features in the Java completable future framework, focusing on how it can be used to develop highly scalable concurrent programs that run efficiently on multi-core processors.
  • Participants will learn the core features of the Java CompletableFuture class, including how to create and “complete” a CompletableFuture instance, as well as how to run it asynchronously in a pool of threads.

Break (5 minutes)

Segment 3 Advanced Features of Java 8 Completable Futures (55mins)

  • Instructor will explain the advanced features of the Java 8 completable futures framework, focusing on its support for asynchronous factory methods, chained completion stages, and “multi-artity” operations.
  • Participants will understand how the advanced features of the Java 8 completable futures framework can be used to chain together multiple asynchronous operations, as well as provide reactive event handling.

Break (5 minutes)

Segment 4 Applying Java 8 Completable Futures to the Several Case Study Apps (40mins)

  • Instructor will conduct a design and code walkthrough of several case study apps, including (1) an Image Crawler app that uses completable futures to download and display images embedded in HTML pages in a recursive web-based folder structure and (2) an ImageStreamGang app that shows how the Java 8 completable futures framework performs image processing operations scalably on multi-core processors.
  • Participants will learn how to apply the Java 8 completable futures framework to several powerful and scalable apps that run both on Android and Java platforms.

Segment 5 Evaluating the Pros and Cons of the Java 8 Completable Futures Framework (10mins)

  • Instructor will review the material covered in this training lesson, focusing on how and when to apply the Java 8 completable futures frameworks effectively, particularly with respect to other Java-based concurrency and parallelism frameworks, such as parallel streams, RxJava, as well as the new reactive programming features defined in Java 9.
  • Participants will be able to develop efficient concurrent programs using powerful Java 8 object-oriented and functional programming language features and reactive programming frameworks.

Note: this ends the metadata collection section of this guide.