Advanced Java Concurrent Patterns

Concurrency is a hard to master topic. This Java course takes you from the basics you already know, (runnable and synchronization) to the next level: the java.util.concurrent API.
Course info
Rating
(77)
Level
Advanced
Updated
Mar 13, 2017
Duration
3h 28m
Table of contents
Course Overview
Introducing the Executor Pattern, Futures and Callables
Using Locks and Semaphores for the Producer / Consumer Pattern
Controlling Concurrent Applications Using Barriers and Latches
Understanding Casing and Atomic Variables
Leveraging Concurrent Collections to Simplify Application Design
Description
Course info
Rating
(77)
Level
Advanced
Updated
Mar 13, 2017
Duration
3h 28m
Description

This course, Advanced Java Concurrent Patterns is an in-depth presentation of advanced fundamentals you'll need to understand to write efficient concurrent applications, that support heavy concurrency and provide high throughput. You'll learn about how you can improve the quality of your concurrent code, by using sophisticated concurrent tools that allow for smooth lock acquisition and fault tolerancy. You'll also be introduced to advanced data structures, such as the copy on write arrays, the concurrent blocking queues, the concurrent skip lists and concurrent hashmaps. By the end of this course, you will understand how to use cyclic barriers, count down latches and semaphores, and how to atomic variables to write non-locking code. All of this will help you on your journey to write better applications.

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
5 Apr 2018
Java Fundamentals: Input/Output
Intermediate
3h 56m
19 Dec 2017
More courses by Jose Paumard
Section Introduction Transcripts
Section Introduction Transcripts

Course Overview
Hi everyone. My name is Jose. Welcome to my course, Advanced Java Concurrent Patterns. I am talking to you from Paris where I am an assistant professor, as well as a speaker at various Java conferences, Java 1 in San Francisco, and Dev Ops here in Europe just to name a few. I know how scary the title of this course might look, but don't be afraid. I'll take you through it step by step. We will see the patterns, how things can go wrong, and how to deal with the situation. If you follow me, at the end of this course, you will have a good idea of the ExecutorService Patterns and callables, and futures, what is interruptible or timed out lock acquisition, what are logs, semaphores, barriers, and latches, and what is CASing, and atomic variables. And at last, we will see the concurrent collections, copy and write release, concurrent hashmaps, and concurrent skip lists. But before you move on, you would like to be familiar with the Java language and the collection API. You also need some knowledge of concurrency and be able to write basic lambda expressions. For that, you can check the Pluralsight library for Java courses on those topics. Yes, this is an ambitious ride, but don't be afraid. Just let me guide you through all this, and you will see that from the other side, concurrencies, in fact, not that scary.

Introducing the Executor Pattern, Futures and Callables
Hello. My name is Jose. I would like to welcome you to this course, Advanced Java Concurrent Patterns, and its first module, Introducing the Executor Pattern, Futures, and Callables. What is this course about? Well, this course is about advanced concurrency in Java, and mainly, how to improve the Runnable pattern in different ways. First, we will talk about the Executor pattern and the futures and callable. We will cover that in details. Then we will talk about the Java primitives introduced to synchronize tasks. Those primitives have been introduced in Java 5. We will then cover in details the compare and swap pattern and atomic variables. We will describe this concept very precisely. And we will finish by browsing the concurrent collections and maps introduced in the Collection Framework. In the module covering Java concurrent primitives, we will cover the lock and the semaphore, which are alternatives to the synchronized block patterns that we will use to implement the Producer/Consumer pattern. And we will also talk about barriers and latches and see the patterns to use them properly.

Using Locks and Semaphores for the Producer / Consumer Pattern
Hello. My name is Jose. I would like welcome you to the second module of this course called Using Locks and Semaphores for the Producer/Consumer Pattern. What are we going to cover in this module? Let us quickly browse through the agenda. Well, this module is about synchronization. Now we have two ways of synchronizing in the Java language, the synchronized keyword that can be used in several ways and the volatile keyword that we can use on failed declarations. Those two keywords are related to what is called intrinsic locking. There is also explicit locking and this is what we are going to see first mainly based on the use of a lock interface. Then, we will see that using this lock interface and the condition interface we can implement the wait/notify pattern in a different and more powerful way. And then, we will see what's semaphores are. Semaphores are not a new concept in Java. It is a concept that comes from operating system and that is implemented in other languages. We will see the Java flavor of semaphores.

Controlling Concurrent Applications Using Barriers and Latches
Hello. My name is Jose. Welcome to this third module of this course, Controlling Concurrent Applications Using Barriers and latches. Let us quickly browse through the agenda of this module. What we are going to see is, in fact, two more concurrent primitives. In the previous module, we saw locks, ReadWriteLocks, and semaphores. Here, we are going to see the barrier and the latch. The barrier is there to have several tasks wait for each other, then trigger a subsequent task or action, and then reset the system so that it can run again. This barrier is called a CyclicBarrier for this reason. The latch works almost in the same way, the main difference being that it does not reset. Once a latch has been opened, it cannot be closed again. So let us see that in details and in action.

Understanding Casing and Atomic Variables
Hello. My name is Jose. Welcome to the fourth module of this course called Understanding CASing and Atomic Variables. What are we going to see in this module? Let us quickly browse through the agenda. This module is all about CASing. Now what does CASing mean? In fact, it means compare and swap, and we are going to see what is it exactly because it is a notion that comes from the CPU from the assembly language and that is available in the JDK. We are going also to see why it is useful to use CASing and how it differs from synchronization, whether it is synchronization using classical synchronized blocks or locking using the lock interface. We are going to see how it has been implemented in the JDK, and what we can find in the JDK to implement CASing, and we would see how and when to use it.

Leveraging Concurrent Collections to Simplify Application Design
Hello. My name is Jose. Welcome to the fifth and last module of this course, Leveraging Concurrent Collections to Simplify Application Design. Let us quickly browse through the agenda of this module. We are going to talk about the Concurrent part of the Collection framework, namely concurrent collections and maps. As you know, there are two kinds of structures in the Collection Framework, first the collections themselves and then the maps. On the collection part, we have two concurrent structures, the Queue and the BlockingQueue, and on the map part, we have the ConcurrentMap, so we are going to cover all of these in this module. We will, of course, also cover the implementations and describe which one should be used and when, especially depending on the concurrency level of your application.