Search⌘ K
AI Features

LockSupport

Explore how the LockSupport class provides low-level thread blocking and unblocking methods like park and unpark. Understand its role in creating synchronization utilities such as FIFO locks. Learn practical use cases and how to manage thread permits and blockers effectively.

If you are interviewing, consider buying our number#1 course for Java Multithreading Interviews.

Overview

The LockSupport class is usually used as one of the building blocks for creating locks and synchronization classes. The class can’t be instantiated and offers static methods for use. These methods of the LockSupport class are designed to be used as tools for creating higher-level synchronization utilities, and are not in themselves useful for most concurrency control applications. The two methods offered by this class are park() and unpark() alongwith their variations. These methods provide low-level alternatives to the deprecated methods Thread.suspend() and Thread.resume().

park

...