Idiomatic use of ReentrantLock in Concurrency package [duplicate]
问题 This question already has answers here : In ArrayBlockingQueue, why copy final member field into local final variable? (2 answers) Closed 3 years ago . While browsing through the source code of the java.util.concurrency package, I noticed an idiomatic use of ReentrantLock that I had not seen before: member RentrantLock variables were never accessed directly from within a method - they were always referenced by a local variable reference. Style #1 e.g from java.util.concurrent