Java · Hard
What is the difference between StampedLock and ReentrantReadWriteLock?
JavaConcurrency
Answer preview
Optimistic reads — StampedLock (Java 8) supports tryOptimisticRead() which returns a stamp without acquiring a lock. Validate the stamp later — if no write occurred, the read succeeds with zero lock overhead.…