Using Java 8 Lambdas and Stampedlock to manage thread safety
summary
Explains using Java 8 StampedLock for optimistic reads ~90% success and when to fall back to a pessimistic read or exclusive write; shows a Position example that moves x and y together and warns StampedLock is non-reentrant so upgrades can fail and are tricky. Compares implementations: AtomicReference CAS and Unsafe/VarHandle approaches (notes VarHandle parity with Unsafe and often similar speed). Presents lambdas to encapsulate lock idioms, notes checked-exception friction and that real benchmarking depends heavily on contention.
AI-written summary · about
chapters (5)
related talks
47mThread Safety with Phaser, StampedLock, and VarHandle
51mThread Safety with Phaser, StampedLock and VarHandle
52mNonblocking algorithms/ CAS/Atomics
48mHandling concurrent access to shared resources in Java
52mSTM and Structured Concurrency — The Battle with Multithreading Dragons
01h 14mThread Safety with Phaser, StampedLock and VarHandle
50mThe Hidden Art of Thread-Safe Programming: Exploring java.util.con...
45mThe Hidden Art of Thread-Safe Programming: Exploring java.util.concurrent
