@Override
  protected E pollFirst() {
    if (workingKeyedElements.isEmpty()) {
      // Switch the two queues
      Map<ID, E> tmp = workingKeyedElements;
      workingKeyedElements = idleKeyedElements;
      idleKeyedElements = tmp;
      SortedSet<E> tmpSet = workingSortedElements;
      workingSortedElements = idleSortedElements;
      idleSortedElements = tmpSet;
    }
    E element = workingSortedElements.first();
    workingSortedElements.remove(element);
    workingKeyedElements.remove(element.getDriverTaskId());
    return element;
  }
Init the queue with max capacity and specified comparator.

@see IndexedBlockingQueue
@param maxCapacity the max capacity of the queue.
@param comparator the comparator for comparing the elements.
@param queryHolder the query holder instance.
@throws IllegalArgumentException if maxCapacity <= 0.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/schedule/queue/L2PriorityQueue.java