Java 8 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.
What you'll learn
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 8 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.
Table of contents
- Version Check 0m
- Introduction to the Course, What Are You Going to Learn? 1m
- Who Are You? What Should You Know to Follow this Course? 2m
- Agenda of the Course 2m
- Agenda of this Module 1m
- Defining the Technical Vocabulary of Asynchronous Programming 4m
- Using the Executor Pattern to Launch Tasks in Other Threads 4m
- Analyzing the Behavior of the Executor Pattern 1m
- Analyzing the Difference Between Concurrent and Asynchronous 3m
- Understanding Blocking Calls and Why You Should Avoid Them 2m
- Analyzing the Patterns an Asynchronous API Should Provide 1m
- Understanding the Synchronous Nature of the Observer Pattern 2m
- Comparing Event Driven and Message Driven Systems 1m
- Module Wrap Up 1m
- Introduction to the Module and Agenda 1m
- Defining a Task 4m
- Using Runnable to Create Tasks 1m
- Using Callable to Create Tasks and Launch Them in Another Thread 1m
- Getting a Future Object with the Executor Pattern 2m
- Creating a CompletableFuture from a Runnable or a Supplier 3m
- Controlling the Thread Executing a Runnable or a Supplier 4m
- Understanding CompletableFuture and CompletionStage 1m
- Comparing the Methods from Future and CompletableFuture 2m
- Completing or Obtruding a CompletableFuture to Produce a Value 1m
- Completing or Obtruding a CompletableFuture to Throw an Exception 1m
- Introducing the Live Demo, Launching a First Task 2m
- Demo: Checking in Which Thread a Task is Running 3m
- Demo: Executing a Supplier Asynchronously and Getting its Result 2m
- Demo: Delaying the Execution of a Supplier Asynchronously 1m
- Demo: Forcing the Completion of a Task Using Complete and Obtrude 2m
- Demo: Creating and Completing a Void CompletableFuture 3m
- Module Wrap Up 1m
- Introduction to the Module and Agenda 1m
- Setting a Pipeline of Tasks as a Map Filter Reduce Pattern 2m
- Sending a Result from a Supplier to a Function 2m
- Launching Runnable, Consumer, and Function After Existing Tasks 3m
- Understanding Single Task Chaining Patterns 3m
- Composing CompletableFutures to Prevent Blocking Calls 4m
- Triggering Tasks on the Completion of Two Tasks 2m
- Triggering Tasks on the Completion of Two Completed Tasks 2m
- Triggering Tasks on the Completion of One of Two Tasks 3m
- Understanding in Which Thread a Triggered Task is Executed 2m
- Analyzing Use Cases to Choose Which Thread is Executing What Task 4m
- Wrapping up the Patterns for Controlling Threads 1m
- Introducing the Live Demo, Chaining the First Tasks 4m
- Demo: Running the Last Task in a Special Thread 1m
- Demo: Composing a Long Running Task with a CompletableFuture 3m
- Demo: Checking in Which Thread an Async Composition is Executed 2m
- Demo: Displaying the Result of Two Tasks in a Third One 3m
- Demo: Displaying the Result of the First Completed Task 4m
- Module Wrap Up 3m
- Introduction to the Module and Agenda 1m
- Introducing How an Exception Affects a Pipeline of Tasks 2m
- Understanding What is Happening When an Exception is Raised 2m
- Undestanding How a Raised Exception Completes a CompletableFuture 1m
- Catching an Exception with the Exceptionally Pattern 3m
- Modifying the Pipeline of Tasks to Catch Exceptions 1m
- Consuming an Exception with the WhenComplete Pattern 2m
- Transforming an Exception with the Handle Pattern 2m
- Introducing the Live Demo, Setting up a Chain That Fails 3m
- Demo: Setting up the Exceptionally Pattern to Catch an Exception 3m
- Demo: Logging an Exception Using the WhenComplete Pattern 3m
- Demo: Providing a Default Value with the Handle Pattern 2m
- Module Wrap Up 3m
- Introduction to the Module and Agenda 1m
- Introducing the HTTP Client Example from Java 10 2m
- Creating the HTTP Client and Request Using the Builder Pattern 2m
- Analyzing Why the HTTP Request Should Be Made Asynchronously 2m
- Understanding the Cost of Moving Tasks to Other Threads 3m
- Comparing the Executor and the CompletableFuture Patterns 2m
- Making the HTTP Request Asynchronous Using CompletableFuture 4m
- Using Delayed Start to Create Costly Chains of Tasks 2m
- Writing the CompletableFuture Delayed Start Pattern 3m
- Introducing the Live Demo, Setting up the Delayed Start Pattern 5m
- Demo: Controlling Threads with the Delayed Start Pattern 2m
- Demo: Setting up the HttpClient Example 4m
- Demo: Running the HttpClient Example and Controlling the Threads 4m
- Demo: Delaying the Start of the HttpClient Example 3m
- Module Wrapup: Three Ideas to Build Performant Async Pipelines 3m
- Course Wrap Up 3m