public void clear(){
  final Object[] items=this.items;
  final ReentrantLock lock=this.lock;
  lock.lock();
  try {
    int k=count;
    if (k > 0) {
      final int putIndex=this.putIndex;
      int i=takeIndex;
      do {
        items[i]=null;
      }
 while ((i=inc(i)) != putIndex);
      takeIndex=putIndex;
      count=0;
      if (itrs != null)       itrs.queueIsEmpty();
      for (; k > 0 && lock.hasWaiters(notFull); k--)       notFull.signal();
    }
  }
  finally {
    lock.unlock();
  }
}

public void clear ( ) { final Object [ ] items = this . items ; final ReentrantLock lock = this . lock ; lock . lock ( ) ; try { int k = count ; if ( k > 0 ) { final int putIndex = this . putIndex ; int i = takeIndex ; do { items [ i ] = null ; } while ( ( i = inc ( i ) ) != putIndex ) ; takeIndex = putIndex ; count = 0 ; if ( itrs != null ) itrs . queueIsEmpty ( ) ; for ( ; k > 0 && lock . hasWaiters ( notFull ) ; k -- ) notFull . signal ( ) ; } } finally { lock . unlock ( ) ; } }
atomically removes all of the elements from this queue . the queue will be empty after this call returns .
