Writing correct, thread-safe code is notoriously challenging. Unlike single-threaded code, concurrency bugs often remain hidden, waiting for the perfect storm of conditions to emerge. Even the standard Vector class, long trusted for its thread safety, harbored a race condition for 5 years, only to introduce a potential deadlock that persisted for the next 9 years. The classes in java.util.concurrent are used in all major Java projects, either directly or indirectly. In this session, we will take a close look at some of the techniques used to create them. We will explore topics like lock striping in LongAdder, lock splitting in LinkedBlockingQueue, weakly consistent iteration in ArrayBlockingQueue, and check-then-act in CopyOnWriteArrayList.

Talk Level:
ADVANCED

Bio:
Heinz is the author of The Java Specialists’ Newsletter (https://www.javaspecialists.eu), a publication enjoyed by tens of thousands of Java experts in over 150 countries.