public void clear() {
    lock.writeLock().lock();
    try {
      // Use a new set to avoid ConcurrentModificationException
      ImmutableSet.copyOf(iteratorSet).forEach(DynamicIterator::close);

      tryRemoveBefore(tailIndex);
    } finally {
      lock.writeLock().unlock();
    }
  }
Clear the queue. All elements will be removed. All iterators will be closed.
iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/datastructure/queue/ConcurrentIterableLinkedQueue.java