public void decreaseFileReaderReference(TsFileResource tsFile, boolean isClosed) {
    synchronized (this) {
      if (!isClosed && unclosedReferenceMap.containsKey(tsFile.getTsFilePath())) {
        if (unclosedReferenceMap.get(tsFile.getTsFilePath()).decrementAndGet() == 0) {
          closeUnUsedReaderAndRemoveRef(tsFile.getTsFilePath(), false);
        }
      } else if (closedReferenceMap.containsKey(tsFile.getTsFilePath())
          && (closedReferenceMap.get(tsFile.getTsFilePath()).decrementAndGet() == 0)) {
        closeUnUsedReaderAndRemoveRef(tsFile.getTsFilePath(), true);
      }
    }
    tsFile.readUnlock();
  }
Decrease the reference count of the reader specified by filePath. This method is latch-free.
Only when the reference count of a reader equals zero, the reader can be closed and removed.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/read/control/FileReaderManager.java