[concurrency-interest] Making copy of a reference to ReentrantLock
Navin Jha
navin.jha at FXALL.com
Fri Jan 21 11:32:37 EST 2011
I was looking at the CopyOnWriteArrayList.java source code and I see that in all the modification methods a copy of the lock is made first, something like:
public E set(int index, E element) {
final ReentrantLock lock = this.lock;
lock.lock();
................................... // rest of the method
I understand that making local copies of object variables would reduce contention but is that the reason for doing this in this case or something else?
Regards,
Navin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://cs.oswego.edu/pipermail/concurrency-interest/attachments/20110121/174a1d45/attachment.html>
More information about the Concurrency-interest
mailing list