public void swapOutFilesIfNecessary() {
        this.readLock.lock();
        try {
            if (this.files.size() <= this.storeOptions.getKeepInMemoryFileCount()) {
                return;
            }
            int filesInMemoryCount = this.allocateService.getAllocatedFileCount();
            int swappedOutCount = 0;
            final int lastIndex = this.files.size() - 1;
            long lastSwappedOutPosition = 0;
            for (int i = lastIndex; i >= 0; i--) {
                final AbstractFile abstractFile = this.files.get(i);
                if (abstractFile.isMapped()) {
                    filesInMemoryCount++;
                    if (filesInMemoryCount >= this.storeOptions.getKeepInMemoryFileCount() && i != lastIndex) {
                        abstractFile.unmmap();
                        swappedOutCount++;
                        if (lastSwappedOutPosition == 0) {
                            lastSwappedOutPosition = abstractFile.getFileFromOffset() + abstractFile.getFileSize();
                        }
                    }
                }
            }
            // Because lastSwappedOutPosition means all the data had been flushed before lastSwappedOutPosition,
            // so we should update flush position
            if (getFlushedPosition() < lastSwappedOutPosition) {
                setFlushedPosition(lastSwappedOutPosition);
            }
            LOG.info("Swapped out {} abstract files", swappedOutCount);
        } catch (final Exception e) {
            LOG.error("Error on swap out files", e);
        } finally {
            this.readLock.unlock();
        }
    }
Check file's correctness of name and length
@return mmap file
jraft-extension/java-log-storage-impl/src/main/java/com/alipay/sofa/jraft/storage/file/FileManager.java