I was reading the ArrayBlockingQueue
implementation code another day by Doug Lea and noticed a lot of methods (public, default, and private)
have the following references:
final Object[] items = this.items;
final ReentrantLock lock = this.lock;
I have asked around to have a reasonable explanation but so far no satisfactory answers. I am not quite sure why we need to have such local variables in the first place? And what is the benefit(s) of coding this way?
Maybe I missed some important points in concurrent programming. Could you please help to shed some lights on this?