Is entering synchronized block atomic?
问题 Do you know if there is guaranteed that synchronized block in java is atomic? Imagine following case Thread_1,2: synchronized(object){object.modify();} (object is shared variable.) imagine thread_M will change reference to object like synchronized(object){object = new Object()} now imagine threads 1 and 2 are competing over getting the lock on object Is it possible that following would happened: 1. Thread1: read old object 2. ThreadM: modify object reference & release old object lock 3.