public synchronized Pair<Long, List<PipeSnapshotEvent>> findAvailableSnapshots() {
    if (queueTailIndex2SnapshotsCache.getLeft()
        < queue.getTailIndex()
            - PipeConfig.getInstance().getPipeListeningQueueTransferSnapshotThreshold()) {
      clearSnapshots();
    }
    return queueTailIndex2SnapshotsCache;
  }
{@link AbstractPipeListeningQueue} is the encapsulation of the {@link
AbstractSerializableListeningQueue} to enable using reference count to control opening and
closing. This class also enables a {@link PipeTask} to find the snapshots close enough to send if
existed.
iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/datastructure/queue/listening/AbstractPipeListeningQueue.java