java.util.concurrent.locks · java.base · since Java 1.8

StampedLock

declaration
public class StampedLock implements Serializable

Three-mode lock with optimistic reads: tryOptimisticRead + validate lets read-mostly hot paths skip locking entirely. Powerful, non-reentrant, expert-tier.

Key methods

long tryOptimisticRead() / boolean validate(long stamp)Lock-free read, then check nothing changed.
long readLock() / writeLock(); unlockRead/Write(stamp)Pessimistic fallbacks.