2

Possible Duplicate:
In ArrayBlockingQueue, why copy final member field into local final variable?

For instance:

private final Object o;

public void doSomething(){

    final Object local = this.o;
    //access methods of local;

}

This practice is followed in lots of java classes (such as ArrayBlockingQueue). What's the benefit of this?

Community
  • 1
  • 1
PRK
  • 959
  • 1
  • 6
  • 3
  • 2
    Duplicate: http://stackoverflow.com/questions/2785964/in-arrayblockingqueue-why-copy-final-member-field-into-local-final-variable/2786019 – ColinD Jun 01 '10 at 19:03
  • A more concrete example would be useful. In `ArrayBlockingQueue` a `ReentrantLock` is used for instance – OscarRyz Jun 01 '10 at 19:06

0 Answers0