Flavours of Concurrency in Java

By Anton Arhipov

Elevator Pitch

An overview of different approaches to write concurrent Java programs

Description

Writing concurrent code that is also correct is unbelievably hard. Naturally, humanity has developed a number of approaches to handle concurrency in the code, starting from basic threads that follow the hardware way to do concurrency to higher level primitives like fibers and work-stealing solutions. But which approach is the best for you?

In this session, we’ll take a look at a simple concurrent problem and solve it using different ways to manage concurrency: threads, executors, actors, fibers, monadic code with completable futures. All these approaches are different from the simplicity, readability, configuration and management point of view.

Some scenarios are better modelled with threads, while sometimes you’re better off with actors. We’ll discuss the benefits of each approach and figure out when it’s worth pursuing in your project.