Java Fundamentals: Asynchronous Programming Using CompletionStage

Java Fundamentals: Asynchronous Programming Using CompletionStage

English | MP4 | AVC 1280×720 | AAC 44KHz 2ch | 3h 04m | 452 MB

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.

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 this will help you creating performant and error-prone asynchronous systems with the only dependency being the JDK itself.

Table of Contents

Course Overview
1 Course Overview

Introducing Asynchronous vs. Concurrent Tasks
2 Introduction to the Course What Are You Going to Learn
3 Who Are You What Should You Know to Follow this Course
4 Agenda of the Course
5 Agenda of this Module
6 Defining the Technical Vocabulary of Asynchronous Programming
7 Using the Executor Pattern to Launch Tasks in Other Threads
8 Analyzing the Behavior of the Executor Pattern
9 Analyzing the Difference Between Concurrent and Asynchronous
10 Understanding Blocking Calls and Why You Should Avoid Them
11 Analyzing the Patterns an Asynchronous API Should Provide
12 Understanding the Synchronous Nature of the Observer Pattern
13 Comparing Event Driven and Message Driven Systems
14 Module Wrap Up

Setting up an Asynchronous Operations with CompletionStage
15 Introduction to the Module and Agenda
16 Defining a Task
17 Using Runnable to Create Tasks
18 Using Callable to Create Tasks and Launch Them in Another Thread
19 Getting a Future Object with the Executor Pattern
20 Creating a CompletableFuture from a Runnable or a Supplier
21 Controlling the Thread Executing a Runnable or a Supplier
22 Understanding CompletableFuture and CompletionStage
23 Comparing the Methods from Future and CompletableFuture
24 Completing or Obtruding a CompletableFuture to Produce a Value
25 Completing or Obtruding a CompletableFuture to Throw an Exception
26 Introducing the Live Demo Launching a First Task
27 Demo – Checking in Which Thread a Task is Running
28 Demo Executing a Supplier Asynchronously and Getting its Result
29 Demo – Delaying the Execution of a Supplier Asynchronously
30 Demo Forcing the Completion of a Task Using Complete and Obtrude
31 Demo – Creating and Completing a Void CompletableFuture
32 Module Wrap Up

Triggering a Task on the Completion of Other Tasks
33 Introduction to the Module and Agenda
34 Setting a Pipeline of Tasks as a Map Filter Reduce Pattern
35 Sending a Result from a Supplier to a Function
36 Launching Runnable Consumer and Function After Existing Tasks
37 Understanding Single Task Chaining Patterns
38 Composing CompletableFutures to Prevent Blocking Calls
39 Triggering Tasks on the Completion of Two Tasks
40 Triggering Tasks on the Completion of Two Completed Tasks
41 Triggering Tasks on the Completion of One of Two Tasks
42 Understanding in Which Thread a Triggered Task is Executed
43 Analyzing Use Cases to Choose Which Thread is Executing What Task
44 Wrapping up the Patterns for Controlling Threads
45 Introducing the Live Demo Chaining the First Tasks
46 Demo – Running the Last Task in a Special Thread
47 Demo – Composing a Long Running Task with a CompletableFuture
48 Demo – Checking in Which Thread an Async Composition is Executed
49 Demo – Displaying the Result of Two Tasks in a Third One
50 Demo – Displaying the Result of the First Completed Task
51 Module Wrap Up

Dealing with Exception in the CompletionStage Pipeline
52 Introduction to the Module and Agenda
53 Introducing How an Exception Affects a Pipeline of Tasks
54 Understanding What is Happening When an Exception is Raised
55 Undestanding How a Raised Exception Completes a CompletableFuture
56 Catching an Exception with the Exceptionally Pattern
57 Modifying the Pipeline of Tasks to Catch Exceptions
58 Consuming an Exception with the WhenComplete Pattern
59 Transforming an Exception with the Handle Pattern
60 Introducing the Live Demo Setting up a Chain That Fails
61 Demo – Setting up the Exceptionally Pattern to Catch an Exception
62 Demo – Logging an Exception Using the WhenComplete Pattern
63 Demo – Providing a Default Value with the Handle Pattern
64 Module Wrap Up

Creating Performant Asynchronous Pipelines with CompletionStage
65 Introduction to the Module and Agenda
66 Introducing the HTTP Client Example from Java 10
67 Creating the HTTP Client and Request Using the Builder Patter
68 Analyzing Why the HTTP Request Should Be Made Asynchronously
69 Understanding the Cost of Moving Tasks to Other Threads
70 Comparing the Executor and the CompletableFuture Pattern
71 Making the HTTP Request Asynchronous Using CompletableFuture
72 Using Delayed Start to Create Costly Chains of Tasks
73 Writing the CompletableFuture Delayed Start Pattern
74 Introducing the Live Demo, Setting up the Delayed Start Patte
75 Demo Controlling Threads with the Delayed Start Pattern
76 Demo – Setting up the HttpClient Example
77 Demo Running the HttpClient Example and Controlling the Threa
78 Demo – Delaying the Start of the HttpClient Example
79 Module Wrapup Three Ideas to Build Performant Async Pipelines
80 Course Wrap Up