@Override
  public E poll() {
    E result = null;
    lock.lock();
    try {
      if (queue.size() > 0) {
        result = queue.poll();
        notFull.signal();
      }
    } finally {
      lock.unlock();
    }
    return result;
  }
Creates a PriorityQueue with the specified capacity that orders its elements according to the
specified comparator.
@param capacity   the capacity of this queue
@param comparator the comparator that will be used to order this priority queue
hbase-server/src/main/java/org/apache/hadoop/hbase/util/BoundedPriorityBlockingQueue.java