public void put(E e) throws InterruptedException {
if (e == null) throw new NullPointerException();
int c = -1;
Node<E> node = new Node<E>(e);
final ReentrantLock putLock = this.putLock;
final AtomicInteger count = this.count;
putLock.lockInterruptibly();
try {
while (count.get() == capacity) {
//请问老师,这里底层是调用的wait()方法吗?
notFull.await();
}
enqueue(node);
c = count.getAndIncrement();
if (c + 1 < capacity)
//请问老师底层这里是调用的notify()方法唤醒一个执行put的线程去put吗?
notFull.signal();
} finally {
putLock.unlock();
}
if (c == 0)
signalNotEmpty();
}