@Override
  public void put(E e) throws InterruptedException {
    Objects.requireNonNull(e);

    lock.lock();
    try {
      while (queue.remainingCapacity() == 0) {
        notFull.await();
      }
      this.queue.add(e);
      notEmpty.signal();
    } finally {
      lock.unlock();
    }
  }
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