public void put(E e) throws InterruptedException {
  if (e == null)   throw new NullPointerException();
  int c=-1;
  Node<E> node=new Node(e);
  final ReentrantLock putLock=this.putLock;
  final AtomicInteger count=this.count;
  putLock.lockInterruptibly();
  try {
    while (count.get() == capacity) {
      notFull.await();
    }
    enqueue(node);
    c=count.getAndIncrement();
    if (c + 1 < capacity)     notFull.signal();
  }
  finally {
    putLock.unlock();
  }
  if (c == 0)   signalNotEmpty();
}

public void put ( E e ) throws InterruptedException { if ( e == null ) throw new NullPointerException ( ) ; int c = - 1 ; Node < E > node = new Node ( e ) ; final ReentrantLock putLock = this . putLock ; final AtomicInteger count = this . count ; putLock . lockInterruptibly ( ) ; try { while ( count . get ( ) == capacity ) { notFull . await ( ) ; } enqueue ( node ) ; c = count . getAndIncrement ( ) ; if ( c + 1 < capacity ) notFull . signal ( ) ; } finally { putLock . unlock ( ) ; } if ( c == 0 ) signalNotEmpty ( ) ; }
inserts the specified element at the tail of this queue , waiting if necessary for space to become available .
