public boolean isNextIndexValid(final long nextIndex) {
    lock.readLock().lock();
    try {
      return firstIndex <= nextIndex && nextIndex <= tailIndex;
    } finally {
      lock.readLock().unlock();
    }
  }
Check if the given index is valid. An index is valid if it is between {@link
ConcurrentIterableLinkedQueue#firstIndex} and {@link ConcurrentIterableLinkedQueue#tailIndex}.
If the queue is empty, the given index is valid if it is equal to {@link
ConcurrentIterableLinkedQueue#firstIndex}.
iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/datastructure/queue/ConcurrentIterableLinkedQueue.java