Strange behavior of StampedLock with Thread class
问题 I'm running this code in IntellijIDEA Community on Windows import static java.lang.Thread.sleep; public class Main { public static void main(String[] args) { StampedLock lock = new StampedLock(); Thread th = new Thread(() -> { long stamp = lock.tryOptimisticRead(); try { System.out.println("Optimistic Lock Valid: " + lock.validate(stamp)); sleep(1); System.out.println("Optimistic Lock Valid: " + lock.validate(stamp)); sleep(2); System.out.println("Optimistic Lock Valid: " + lock.validate