O'Reilly logo
live online training icon Live Online training

Scalable Concurrency with the Java Executor Framework

Douglas Schmidt

Attendees in this course will learn how to apply key classes in the Java executor framework to develop more efficient concurrent programs that run scalably on multi-core processors using Java’s powerful object-oriented and functional programming language features. The Java executor framework provides an integrated set of interfaces & classes that collaborate to provide a reusable software architecture for various types of thread pools and associated creation and management strategies. This training focuses on the structure and functionality of Java’s executor framework interfaces, such as Executor, ExecutorService, ScheduledExecutorService, and CompletionService, as well as key classes that implement these interfaces, such as ThreadPoolExecutor, ForkJoinPool, ScheduledThreadPoolExecutor, and ExecutorCompletionService. This course assumes working knowledge of Java and presents many concrete examples of applying the Java executor framework, all of which are available as open-source.

What you'll learn-and how you can apply it

  • Develop efficient concurrent programs using powerful Java object-oriented and functional programming language features and the Java executor framework.
  • Learn how the Java ThreadPoolExecutor, ForkJoinPool, ScheduledThreadPoolExecutor, and ExecutorCompletionService classes can be applied to provide the foundation for concurrent processing on multi-core platforms.
  • Know where to find additional sources of information on how to successfully develop robust concurrent programs using the Java executor framework.

This training course is for you because...

  • For software developers creating scalable apps on modern multi-core processors in Java.

Prerequisites

  • This training is intended for software developers who are familiar with

  • General object-oriented design and programming concepts, such as encapsulation, abstraction, polymorphism, extensibility, and the Unified Modeling Language (UML),

  • Core object-oriented programming language features, such as classes, inheritance, dynamic binding, and generics, that are available in Java,
  • Core functional programming features, such as lambda expressions, method references, and functional interfaces, that are available in Java, and
  • Core functional programming features in Java are covered in another Live Training course entitled Programming with Java 8 Lambdas and Streams

  • Need to know how to download and install the Java JDK and JRE

  • Need to know how to download and install an IDE, such as IntelliJ, NetBeans, Eclipse, or Android Studio

Course Set-up:

  • An installed copy of the Java JDK and JRE (Java 8 or 9 versions are preferred)
  • An installed copy of IntelliJ, NetBeans, Eclipse, or Android Studio

Recommended Preparation

Recommended Follow-up - LiveLessons: Java Concurrency (2nd edition)

About your instructor

Schedule

The timeframes are only estimates and may vary according to how the class is progressing

Segment 0 Overview of the Course (5 minutes) - Instructor will explain the contents covered in this course and provide links to additional online resources.

Segment 1 Overview of the Java Executor Framework (10 minutes) - Instructor will describe the structure and functionality of the Java executor framework, focusing on the various types of thread pools it supports. This segment will also outline the key interfaces that comprise the Java Executor framework and provide an overview of the Java Executors utility class whose factory methods create various types of thread pools.

Segment 2 The Java Executor Framework Interfaces (40 minutes) - Instructor will describe describes the Java Executor, ExecutorService, and ScheduledExecutorService interfaces and show examples of how to write concurrent programs using these interfaces in conjunction with the Java Executors utility class.

Break (5 minutes)

Segment 3 The Java ThreadPoolExecutor Class (20 minutes) - Instructor will describe the structure and functionality of the Java ThreadPoolExecutor class and give an example of using it to implement an app that demonstrates its fixed-sized and cached policies.

Segment 4 The Java ForkJoinPool Class (35 minutes) - Instructor will describe the computational model of the Java fork-join pool framework, summarizes its structure and functionality, explain how it functions internally, and show examples of how to apply it in practice.

Break (5 minutes)

Segment 5 The Java FutureTask Class (25 minutes) - Instructor will describe the Java FutureTask class and give an example of using it to implement an app that demonstrates a concurrent memoizer.

Segment 6 The Java ScheduledExecutorService interface ScheduledThreadPoolExecutor Class (30 minutes) - Instructor will describe the Java ScheduledExecutorService interface and ScheduledThreadPoolExecutor class and show how they can be applied to implement an app containing a timed memoizer.

Break (5 minutes)

Segment 7 The Java CompletionService Interface and ExecutorCompletionService Class (40 minutes) - Instructor will describe the structure and functionality of the Java CompletionService interface and ExecutorCompletionService class, as well as show how they can be applied to implement an app containing yet another variant of timed memoizers.

Segment 8 Pros and Cons of the Java Executor Framework (20 minutes) - Instructor will summarize the pros and cons of the Java executor framework, focusing how to successfully apply the features provided by this framework in practice. - Participants will understand the tradeoffs between the Java executor framework and other related frameworks in Java, such as Java 8 parallel streams and Java 8 completable futures.