Java Fundamentals: Asynchronous Programming Using CompletionStage

Asynchronous programming is what the CompletionStage API, from the JDK, brings you. This course covers all the patterns you need to create efficient asynchronous data processing pipelines, including thread control and error recovery.
Course info
Rating
(17)
Level
Intermediate
Updated
Jul 30, 2018
Duration
3h 4m
Table of contents
Course Overview
Introducing Asynchronous vs. Concurrent Tasks
Setting up an Asynchronous Operations with CompletionStage
Triggering a Task on the Completion of Other Tasks
Dealing with Exception in the CompletionStage Pipeline
Creating Performant Asynchronous Pipelines with CompletionStage
Description
Course info
Rating
(17)
Level
Intermediate
Updated
Jul 30, 2018
Duration
3h 4m
Description

As a Java developer, being able to create asynchronous systems allows you to develop very efficient applications, that need both throughput and performance. In this course, Java Fundamentals: Asynchronous Programming Using CompletionStage, you will learn all the patterns brought to you by this API. First, you will learn the concepts of asynchronous programming: tasks, non-blocking calls and multi-threaded systems. Then, you will see how to build data processing pipelines where the completion of a first task automatically triggers the execution of a next task, passing data to it. Finally, you will see how to create performant systems by controlling the execution of each task in the right thread. Mastering all of this will help you in creating performant and error-free asynchronous systems with the only dependency being the JDK itself.

About the author
About the author

Passionate about programming computers for over 20 years, Jose made his debut in assembler and C, C for SIMD parallel machines before adopting Java as an object-oriented language. Assistant professor in Paris North University for more than 15 years, Jose also brings his expertise to many projects, in various industrial fields.

More from the author
Eclipse for Java Developers
Intermediate
3h 22m
Apr 5, 2018
More courses by Jose Paumard
Section Introduction Transcripts
Section Introduction Transcripts

Course Overview
Hello. My name is Jose. I'm a Java champion and Java 1 rock star. I live in Paris, and I'm very excited to present my new course, Java Fundamentals: Asynchronous Programming Using CompletionStage. This course is about creating asynchronous non-blocking applications and systems in Java. First, you will learn the technical terms, the technical vocabulary you need, then you will see how to set up complex asynchronous data processing pipelines made of tasks that are executed automatically passing data from one another. You will be able to create robust systems, handling errors and exceptions in a proper way to log them or to recover from them. And then you will see how to finally control which thread executes which task for optimal performance, all this with many examples and live demos. Before you move on, be sure to be familiar with all these, the Java language, a little bit of concurrency, and the exception system in Java. Asynchronous programming is not an easy topic, and I will be very happy to show you how it works in the JDK and make the CompletionStage API a tool that will help you become a better Java application developer.

Introducing Asynchronous vs. Concurrent Tasks
Hello. My name is Jose. I am very happy to welcome you to this course, Java Fundamentals Asynchronous Programming Using CompletionStage, and to this module, Introducing Asynchronous Versus Concurrent Tasks. What are you going to learn in this course? Well this course is all about this CompletionStage/CompletableFuture API introduced in Java 8. It is about creating pipelines of tasks, and namely, pipelines of asynchronous tasks. So we are going to conduct asynchronous computation in Java. This is what this course is about. This is mainly what you're going to learn during this course. Of course, you will see how to handle error in this way since, as you're going to see, the try/catch pattern will not work very well. And you will also get hints about performance, how to build such pipelines in a performant way.

Setting up an Asynchronous Operations with CompletionStage
Hello. My name is Jose. Welcome back. In this module, you are going to set up your first asynchronous operations with the CompletionStage API. Let us quickly browse through the agenda of this module. First, we are going to talk about the concept of asynchronous operation and talk about the notion of task. What is a task, how can we model it, and what you can do with it. We will first begin with a quick introduction of this notion of task and how it has been used before the CompletionStage API was introduced. Then you will see what it means to launch a task in an asynchronous way and how you can do that. We will be covering all the patterns available, all the patterns you need to know in this topic, including in the live coding part of this module.

Triggering a Task on the Completion of Other Tasks
Hello. My name is Jose. Welcome back to the module of this course about asynchronous computation in Java using CompletableFuture. You are going to learn how to trigger a task, how to trigger the execution of a task on the completion of other tasks. This is the subject of this module. Let us quickly browse through the agenda. You are going to see how to chain task using the CompletableFuture API. You will see how to create pipelines of tasks, combine tasks, and compose tasks using the API, and run them asynchronously. And you will see how to control in which thread each task is executed by using executor services.

Dealing with Exception in the CompletionStage Pipeline
Hello. My name is Jose. I'm very happy to see you back for this module, dealing with exceptions in the CompletionStage pipeline of this Java Fundamentals Asynchronous Computations Using the CompletionStage API. So let us quickly browse through the agenda of this module. This module is all about dealing with exceptions. You are going to see the APIs provided by the completable futures to deal with exceptions. Basically, in a nutshell, exceptions can be caught directly in the pipeline and then processed or rethrown as per units.

Creating Performant Asynchronous Pipelines with CompletionStage
Hello. My name is Jose. I would like to welcome you back for the last module of this course about the CompletableFuture API in Java. And this module is all about performance, creating performant asynchronous pipelines with CompletionStage. Before we start, let us quickly browse through the agenda of this module. This module, as I just said, is all about performance. So you are going to see hints and tricks on how to write performant pipelines using the CompletionStage and the CompletableFuture API. In fact, what is at the core of this module is to understand the multi-threaded nature of the CompletableFuture API and the first consequence of it is that when you want to move a computation from one thread to another, it will move data across those threads and this is going to be very costly. So we are going to analyze several use cases, see what data is moved from one thread to another precisely on those use cases and see how we can deal with it.