private Iterator<RecordNode> iterator() {
      return new Iterator<RecordNode>() {
        private RecordNode next = null;
        private RecordNode cur = head;

        @Override
        public boolean hasNext() {
          if (next == null && cur.next != tail) {
            next = cur.next;
          }
          return next != null;
        }

        @Override
        public RecordNode next() {
          if (!hasNext()) {
            throw new NoSuchElementException();
          }
          cur = next;
          next = null;
          return cur;
        }

        @Override
        public void remove() {
          if (next == null && cur.next != tail) {
            next = cur.next;
          }
          RecordList.this.remove(cur);
        }
      };
    }
If there is a ReleaseTask or FlushTask, block the current thread to wait up to
MAX_WAITING_TIME_WHEN_RELEASING. The thread will be woken up if the ReleaseTask or FlushTask
ends or the wait time exceeds MAX_WAITING_TIME_WHEN_RELEASING.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/pbtree/memory/ReleaseFlushMonitor.java