4.39 out of 5
4.39
15 reviews on Udemy

MultiThreading,Parallel & Asynchronous Coding in Modern Java

Learn to write Multithreaded code in Modern Java using the ParallelStreams API and CompletableFuture API.
Instructor:
Dilip S
216 students enrolled
English [Auto]
Learn to write code that provides faster results using the modern apis in Java
Learn to write Asynchronous/Parallel Programming code using Functional Style APIs
Learn to write parallel programming code using ParallelStreams
Learn to write Asynchronous code using Completablefuture
Learn to write code that uses all the cores in your machine
Techniques and patterns that uses the modern concurrency apis to improve the overall performance of the code
Concurrency vs Parallelism

This course is structured to give you the theoretical and coding experience writing parallel and asynchronous code using ParallelStreams and CompletableFuture. You will become very Fluent in writing Asynchronous/Parallel Code in Java once you complete this course.

If you are looking forward to writing High Performant Java code then this is the right course for you. This course covers the latest features that are available in Modern Java that helps you write fast performing code.

This course explicitly covers the following APIs in Modern Java:

  • ParallelStreams

  • CompletableFuture

Getting Started with Parallel and Asynchronous programming

  • In this section, I will explain about the need to learn about the Parallel and Asynchronous programming concepts in todays software development

  • Briefly talks about the Evolution of Concurrency APIs in Java

  • Explain about the difference between the Concurrency and Parallelism

Course Project SetUp

  • In this section, we will set up the base project for the whole course.

Threads, Future, ForkJoin FrameWork, and its Limitations

  • In this section, I will explain about Threads, Future API, ForkJoin FrameWork and its limitations

  • I will show a demonstration of all these concepts using code examples.

  • The limitations that are covered in the course sets the stage for ParallelStreams and CompletableFuture API

Getting started with Parallel Streams

  • In this section, I will introduce you all to parallel streams and implement a simple example using Parallel Streams

  • Introduction to Streams API and ParallelStreams

  • Implement a simple example using ParallelStreams 

  • Write unit tests to test the ParallelStreams using JUnit5

Build Retail Checkout Application using Parallel Streams

  • In this section, we will build a simple Backend Retail Checkout application using Parallel Streams

Parallel Streams – Under the hood

  • In this section, I will cover the internals of parallel streams.

  • I will explain about how ParallelStreams work under the hood

  • Compare the performance of different collections when it’s used against the ParallelStreams

  • Usage of Collect vs Reduce terminal operators in Streams API and Parallel Streams

  • Operators that can cause poor performance when it’s used against ParallelStreams

Parallel Streams – Threading Model & Common ForkJoin Pool

  • In this section, I will explain about the execution engine behind the parallel Streams

  • Covers the Threading model that’s utilized behind the scenes by ParallelStreams

  • Configuring the ThreadPool for Faster Performance

Parallel Streams – Summary

  • This section summarizes everything that’s discussed above that’s related to ParallelStreams

  • Covers the scenarios on “when to use/when not to use” ParallelStreams

CompletableFuture

  • In this section, I will introduce you all to the CompletableFuture API

Exploring CompletableFuture Functions

  • In this section, I will code and explore the functions that are part of the CompletableFuture API

  • Explore some of the key functions that are part of the CompletableFuture API

  • Write unit tests to test the CompletableFuture using JUnit5

Build a ProductService application using CompletableFuture

  • In this section, we will implement the ProductService example using CompletableFuture

  • This section will give you all an idea about how to use CompletableFuture in a real-world scenario

Combining Streams and CompletableFuture

  • In this section, I will show you the techniques to combine Streams with CompletableFuture.

  • I will explore this by adding an enhancement to the ProductService which is the InventoryService

  • Explore the different options available to integrate Streams API with CompletableFuture

Exception Handling/Recovery in CompletableFuture

  • In this section, I will introduce you to to the techniques/options that are to handle/recover exceptions using CompletableFuture

  • I will explain and cover different exception handling and recovery techniques that are available in CompletableFuture

    • handle()

    • exceptionally()

    • whenComplete

  • I will compare and explain the difference of behaviors between them and provide recommendation on using different handlers for different use cases.

Implement Exception Handling/Recovery in ProductService

  • In this lecture, I will show you techniques to implement the exception handling techniques in our ProductService

  • Implement the exception handling and recovery technique in  ProductInfoService, ReviewService and  InventoryService

CompletableFuture & ThreadPool

  • In this section, I will cover the ThreadPool and the different options that are available to use with CompletableFuture

  • I will cover the default CommonForkJoin ThreadPool thats used to execute the CompletableFuture

  • I will cover the techniques to use a Custom ThreadPool that can be used to execute the CompletableFuture

Threads and Async Overloaded Methods in CompletableFuture

  • I will cover the threads that are used to execute CompletableFuture

  • I will show the technique to use Async() methods that’s part of the CompletableFuture API to change the execution of threads in the CompletableFuture Pipeline

Build RestFul API Client using Spring WebClient and CompletableFuture

  • In this section, I will build a restful api client using Spring WebClient and Integrate with CompletableFuture to improve the performance of the api calls.

  • I will code and demonstrate how to use Spring WebClient to build a rest client

  • I will code and demonstrate the technique to integrate RestAPI calls with CompletableFuture to improve the overall performance of the code.

Handle Multiple CompletableFutures – anyOf(), allOf()

  • In this section, I will code and explain about the techniques to handle multiple CompletableFutures.

  • I will code and explore the allOf() function thats part of the CompletableFuture API

  • I will code and explore the anyOf() function thats part of the CompletableFuture API

By the end of this course, you will have a complete understanding of ParallelStreams and CompletableFuture and how to use them in your projects.

Getting Started With the Course

1
Course Introduction & Objectives

In this lecture, I will give you all a quick introduction to the course and the objectives of the course

2
Prerequisites

In this lecture, I will explain about the prerequisites that are needed to make the most out of this course.

Getting Started with Parallel and Asynchronous programming

1
Why Parallel Programming and Asynchronous Programming?

In this lecture, I will discuss and explain the need for parallel and asynchronous programming models in Java

2
Evolution of Concurrency/Parallelism APIs in Java

In this lecture, I will give an overview of different concurrency APIs that got released in Java until today.

3
Concurrency vs Parallelism

In this lecture, I will cover the differences between concurrency and parallelism and provide a clear distinction between them.

Course Project SetUp

1
Course Project SetUp

In this lecture, we will set up the project for this course.

Threads, Future, ForkJoin and its Limitations

1
Section Overview

In this lecture, I will give the overview of this section.

2
Overview of the Service & Code Walkthrough

In this lecture, I will give you all a quick overview of the application we are going to work on in this section and code walkthrough of the product service.

3
Threads and its Limitations - Hands On

In this lecture, I will give you all an overview of thread and refactor our product service to use threads to improve the performance of the code.

4
Introduction to ThreadPool/ExecutorService & Future

In this lecture, I will explain about Threadpool, Executorservice, Future and how these concepts are related to each other

5
ExecutorService/Future and its limitations - Hands On

In this lecture, I will demonstrate the Executorservice and futures using code. I will refactor the ProductorService to use the Executorservice and Future APIs and explain about its limitations.

6
Fork-Join Framework

In this lecture, I will cover the fork-join framework that got introduced as part of Java 7.

7
Fork Join Framework - Hands On

In this lecture, I will code and explain the techniques to work with the fork-join framework.

Getting started with Parallel Streams

1
Introduction to Streams API & Parallel Streams

In this lecture, I will give you all an introduction to parallel streams.

2
Parallel Streams - Hands On

In this lecture, I will implement a simple example using parallel streams and improve the performance of the code.

3
Unit Testing Parallel Streams - JUnit5

In this lecture, we will write a JUnit test case for the parallelstream() function

4
Sequential() and Parallel() Functions in Streams API

In this lecture, we will code and explore the sequential() and parallel() functions in Streams API

5
Parallel Streams - Transform to lowerCase using Parallel Streams

Build Retail Checkout Application using Parallel Streams

1
Overview of the Application

In this lecture, I will explain about the checkout application that we are going to build in this section

2
Implement the Checkout Application using parallel Streams

In this lecture, we will code the backend checkout application.

3
Unit Test for the Checkout Application - JUnit5

In this lecture, we will start to write some unit test cases for the checkout application

4
Create a cart of 25 elements and Perform the checkout

Parallel Streams - Under the hood

1
Parallel Streams - How it works ?

In this lecture, I will explain about the internals of parallel streams and how it works to improve the performance overall performance of the code.

2
Comparing Spliterator Performances - ArrayList vs LinkedList - Part 1

In this lecture, we will code and explore the performance of the ArrayList Spliterator and LinkedList Spliterator.

3
Comparing Spliterator Performances - ArrayList vs LinkedList - Part 2

In this lecture, we will code and explore the performance of the ArrayList Spliterator and LinkedList Spliterator.

4
Parallel Streams - Final Computation Result Order

In this lecture, we will code and learn the how the parallel streams maintains the order of the results.

5
Collect & Reduce Terminal Operation in Parallel Streams

In this lecture, we will explore the collect and reduce terminal operation in parallel streams.

6
Collect vs Reduce - Hands On

In this lecture, we will implement the collect() and reduce() operation in our checkout service.

7
Identity in reduce() Operator

In this lecture, we will code and explore the identity thats part of the reduce() terminal operation

8
Streams API Operators - Poor Performance

In this lecture, we will code and explore some of the Stream API operators that performs really poor when run as parallelStreams

Parallel Streams - Threading Model & Common ForkJoin Pool

1
Internals of Common ForkJoin Pool

In this lecture, I will cover the internals of Common ForkJoin Pool and how it works.

2
Parallelism & Threads in ForkJoin Pool

In this lecture, I will cover the parallelism and threads involved in the common forkjoin pool

3
Modifying the Default parallelism in Parallel Streams

In this lecture, we will code and learn about how to change the default parallelism in Parallel Streams.

Parallel Streams - Summary

1
Parallel Streams - Summary

In this lecture, I will quickly summarize the parallel streams and cover when to use parallel and when not to use them.

CompletableFuture

1
Introduction to CompletableFuture

In this lecture, I will introduce you all to CompletableFuture and provide an insight into the CompletableFuture API

Exploring CompletableFuture Functions

1
Lets write our first CompletableFuture

In this lecture, we will write our very first Completable Future and then we will learn about how to initiate a background task and retrieve the result

2
Transform Data using "thenApply()"

In this lecture, we will code and learn the thenApply() function to transform data from one form to another.

3
Unit Testing CompletableFuture using JUnit5

In this lecture, we will write our very first JUnit test for the CompletableFuture.

4
Assignment - Add the length of the string to the output
5
Combing independent Async Tasks using "thenCombine"

In this lecture, we will code and learn about combining independent futures to produce a final result

6
Combing 3 Independent Async Tasks using "thenCombine"

In this lecture, we will code and learn about combining 3 independent futures to produce a final result.

7
Assignment - Combine 4 Independent Async Tasks
8
Invoking Async Tasks using "thenCompose"

In this lecture, we will code and learn about invoke Async Tasks using thenCompose() Completion Stage method.

Build ProductService Application using CompletableFuture

1
Implement ProductService using CompletableFuture - Approach 1

In this lecture, we we will refactor the ProductService and then implement the same using CompletableFuture

2
Implement ProductService using CompletableFuture - Approach 2

In this lecture, we we will refactor the ProductService and then implement the same using CompletableFuture

3
Write the test case for this 'retrieveProductDetails_approach2' function

Combining Streams and CompletableFuture

1
Adding Inventory Details to a Product

In this lecture, we will add an enhancement to the productservice which includes adding Inventory details about the product using Inventory Service

2
Integrate InventoryService in ProductService - Approach 1

In this lecture, we will integrate the inventory service into the Product Service

3
Integrate InventoryService in ProductService - Approach 2

In this lecture, we will integrate the inventory service into the Product Service

Exception Handling/Recovery in CompletableFuture

1
Different Strategies/Options to handle Exceptions in CompletableFuture

In this lecture, I will talk about the exception handling in Java and the newer options that are available to handle exceptions in CompletableFuture

2
Handle/Recover Exceptions using "handle" function

In this lecture, I will code and explain about the handle method thats part of the completablefuture to handle/exceptions exceptions

3
Handle/Recover Exceptions using "handle" function - Part2

In this lecture, I will code and explain some additional scenarios to consider when handling exceptions using CompletableFuture

4
Handle/Recover Exceptions using "handle" function - Part3

In this lecture, I will summarize the exception handling and recovery using the handle method.

5
Handle/Recover Exceptions using "exceptionally" function

In this lecture, I will code and explain about the "exceptionally" method thats part of the completablefuture to handle/exceptions exceptions

6
Handling Exceptions using "whenComplete" function

In this lecture, I will code and explain about the "whenComplete" method thats part of the completablefuture to handle/exceptions exceptions

Implement Exception Handling/Recovery in ProductService

1
Handle/Recover Exceptions in ReviewService

In this lecture, I will code and explain the exception handling for the review service

2
Handle/Recover Exceptions in ProductInfoService

In this lecture, I will code and explain the exception handling for the ProductInfo service

3
Assignment - Handle/Recover Exceptions in Inventory Service

CompletableFuture & Threadpool

1
CompletableFuture - Default ThreadPool

In this lecture, I will demonstrate the default threadpool that completablefuture uses behind the scenes.

2
CompletableFuture - User Defined ThreadPool using ExecutorService

In this lecture, I will demonstrate how to use an ExecutorService Threadpool with Completablefuture.

Threads and Async Overloaded Methods in CompletableFuture

1
Threads in CompletableFuture

In this lecture, I will explain the threads that are involved in the completablefuture pipeline.

2
Async() overloaded functions in CompletableFuture

In this lecture, we will explore the async overloaded method in completablefuture.

Build RestFul API Client using Spring WebClient and CompletableFuture

1
Overview of the GitHub Jobs API

In this lecture, I will give you an overview of the Github jobs api and set up the WebClient in to the project.

2
Build the Rest Client using Spring WebClient - Part 1

In this lecture, I will code and demonstrate how to build a Rest Client for Github jobs api using Spring WebClient

3
Build the Rest Client using Spring WebClient - Part 2

In this lecture, I will code and demonstrate how to build a rest client for Github jobs api using Spring WebClient

4
Combining CompletableFuture and RestClient

In this lecture, I will code and demonstrate how to use the CompletableFuture to improve the overall performance of the Github jobs API functionality.

Handle Multiple CompletableFutures - anyOf(), allOf()

1
Dealing with Multiple CompletableFutures - allOf()

In this lecture, I will code and explain the allOf() function thats part of CompletableFuture to handle multiple CompletableFutures

2
Dealing with Multiple CompletableFutures - anyOf()

In this lecture, I will code and explain the anyOf() function thats part of CompletableFuture to handle multiple CompletableFutures

You can view and review the lecture materials indefinitely, like an on-demand channel.
Definitely! If you have an internet connection, courses on Udemy are available on any device at any time. If you don't have an internet connection, some instructors also let their students download course lectures. That's up to the instructor though, so make sure you get on their good side!
4.4
4.4 out of 5
15 Ratings

Detailed Rating

Stars 5
9
Stars 4
3
Stars 3
2
Stars 2
1
Stars 1
0
253c7c6901a2ad8849701db13e48d692
30-Day Money-Back Guarantee

Includes

7 hours on-demand video
Full lifetime access
Access on mobile and TV
Certificate of Completion