Skip to content
  • Sign In
  • Try Now
View all events
Java

Java Concurrency in 2 Weeks

Published by O'Reilly Media, Inc.

Intermediate content levelIntermediate

From fundamentals to advanced topics and virtual threads

Course outcomes:

  • Understand Java’s original concurrency model based on synchronization
  • Learn how the more modern java.util.concurrent libraries work
  • Why concurrency and performance are so interconnected
  • Understand how concurrency and functional programming can be used together in Java

Course description

Join expert Ben Evans to gain confidence and proficiency with concurrent programming in Java and to tackle themes at the forefront of Java concurrency, including cutting-edge features such as virtual threads. You’ll take a deep dive into how Java’s concurrency actually works, from the “classic” concurrency API based on synchronization to the more modern approaches that rely on the classes in java.util.concurrent. Then you’ll take a closer look at the advanced java.util.concurrent libraries and their implementation as well as the deep underpinnings of the new virtual threads feature—why it is necessary, and its importance for modern Java developers.

NOTE: With today’s registration, you’ll be signed up for both weeks. Although you can attend either of the sessions individually, we recommend participating in both.

What you’ll learn and how you can apply it

  • Start building your own concurrent applications
  • Decide when each technique is appropriate for your application
  • Safely migrate legacy synchronized code to modern approaches
  • Combine functional programming techniques with CompletableFuture
  • Evaluate whether particular workloads are better suited for virtual or platform threads
  • Apply context-based approaches using scope literals
  • Build fire-and-forget solutions using virtual threads

This live event is for you because...

  • You’re a mid-level or advanced-level Java dev who wants to understand cutting-edge Java features.
  • You work with concurrent or distributed systems.
  • You want to become an architect or senior developer.

Prerequisites

  • A computer with a Java environment and IDE installed (Java 11 or 17 for the best experience)
  • Medium to advanced knowledge of Java programming
  • Any knowledge of concurrency in other languages (helpful but not required)
  • Basic working knowledge of CPU architecture (useful but not required)

Recommended follow-up:

Schedule

The time frames are only estimates and may vary according to how the class is progressing.

Week 1

Synchronization (60 minutes)

  • Presentation: Simple hardware model; the need for synchronization; the original thread and synchronization API
  • Hands-on exercises: Explore effect of hardware caching; explore the relative speed of synchronized versus unsynchronized access
  • Break

Introducing executors and thread pools (60 minutes)

  • Hands-on exercises: Explore the limitations of thread; rewrite a synchronization example with executors
  • Presentation: Executors in java.util.concurrent; locks in java.util.concurrent
  • Break

Introducing concurrent data structures (60 minutes)

  • Presentation: Overview of concurrent data structures; latches and barriers
  • Hands-on exercises: Explore atomics, ConcurrentHashMap, and blocking queues
  • Break

Practical considerations (60 minutes)

  • Presentation: Amdahl’s law and Little’s law
  • Group discussion: Queuing theory
  • Hands-on exercises: Thread pools and how to size them
  • Q&A

Week 2

Advanced concurrency libraries (60 minutes)

  • Presentation: Introduction to fork and join; work-stealing thread pool; CompletableFuture
  • Group discussion: Are parallel streams worth it?
  • Hands-on exercise: Explore FP aspects of CompletableFuture
  • Break

Inside java.util.concurrent (60 minutes)

  • Presentation: Inside AtomicInteger; introduction to VarHandles
  • Hands-on exercise: Explore relative speed of atomic/CAS access
  • Group discussion: Compare lock-free and synchronization-based algorithms
  • Break

Introducing virtual threads (60 minutes)

  • Group discussion: Threads are a scarce resource; limitations of virtual threads
  • Presentation: Solving the thread bottleneck; the new virtual thread executors
  • Hands-on exercise: A first look at virtual threads in action
  • Break

Structured concurrency and scope literals (60 minutes)

  • Group discussion: Why structured concurrency?; scope literals; the future of Java concurrency
  • Hands-on exercises: Structured concurrency examples; scope literals in action
  • Q&A

Your Instructor

  • Ben Evans

    Ben Evans is a Java Champion and Senior Principal Software Engineer at Red Hat. Previously he was Lead Architect for Instrumentation at New Relic, and co-founded jClarity, a performance tools startup acquired by Microsoft. He has also worked as Chief Architect for Listed Derivatives at Deutsche Bank and as Senior Technical Instructor for Morgan Stanley. He served for 6 years on the Java Community Process Executive Committee, helping define new Java standards. Ben is the author of six books, including "Optimizing Java", the new editions of “Java in a Nutshell” and the recently-updated “The Well-Grounded Java Developer” and writes regularly for Oracle's Java Magazine and other industry publications.

    Xlinksearch