芝加哥去的狗爸狗妈都来报个到吧!# pets - 心有所宠
e*9
1 楼
http://www.docjar.com/html/api/java/util/concurrent/ArrayBlocki
public boolean offer(E e) {
if (e == null) throw new NullPointerException();
// why it makes a reference to the lock here?
final ReentrantLock lock = this.lock;
lock.lock();
try {
if (count == items.length)
return false;
else {
insert(e);
return true;
}
} finally {
lock.unlock();
}
}
final ReentrantLock lock = this.lock; 有什么特殊的地方?我什么不能直接用this
.lock,而要绕一下呢?
public boolean offer(E e) {
if (e == null) throw new NullPointerException();
// why it makes a reference to the lock here?
final ReentrantLock lock = this.lock;
lock.lock();
try {
if (count == items.length)
return false;
else {
insert(e);
return true;
}
} finally {
lock.unlock();
}
}
final ReentrantLock lock = this.lock; 有什么特殊的地方?我什么不能直接用this
.lock,而要绕一下呢?