类 FileReaderManager
- java.lang.Object
-
- org.apache.iotdb.db.query.control.FileReaderManager
-
public class FileReaderManager extends java.lang.Object
FileReaderManager is a singleton, which is used to manage all file readers(opened file streams) to ensure that each file is opened at most once.
-
-
方法概要
所有方法 静态方法 实例方法 具体方法 修饰符和类型 方法 说明 void
closeAndRemoveAllOpenedReaders()
Only forEnvironmentUtils.cleanEnv
method.void
closeFileAndRemoveReader(java.lang.String filePath)
boolean
contains(TsFileResource tsFile, boolean isClosed)
This method is only for unit tests.void
decreaseFileReaderReference(TsFileResource tsFile, boolean isClosed)
Decrease the reference count of the reader specified by filePath.org.apache.iotdb.tsfile.read.TsFileSequenceReader
get(java.lang.String filePath, boolean isClosed)
Get the reader of the file(tsfile or unseq tsfile) indicated by filePath.java.util.Map<java.lang.String,org.apache.iotdb.tsfile.read.TsFileSequenceReader>
getClosedFileReaderMap()
static FileReaderManager
getInstance()
java.util.Map<java.lang.String,org.apache.iotdb.tsfile.read.TsFileSequenceReader>
getUnclosedFileReaderMap()
void
increaseFileReaderReference(TsFileResource tsFile, boolean isClosed)
Increase the reference count of the reader specified by filePath.void
writeFileReferenceInfo()
-
-
-
方法详细资料
-
getInstance
public static FileReaderManager getInstance()
-
closeFileAndRemoveReader
public void closeFileAndRemoveReader(java.lang.String filePath) throws java.io.IOException
- 抛出:
java.io.IOException
-
get
public org.apache.iotdb.tsfile.read.TsFileSequenceReader get(java.lang.String filePath, boolean isClosed) throws java.io.IOException
Get the reader of the file(tsfile or unseq tsfile) indicated by filePath. If the reader already exists, just get it from closedFileReaderMap or unclosedFileReaderMap depending on isClosing . Otherwise a new reader will be created and cached.- 参数:
filePath
- the path of the file, of which the reader is desired.isClosed
- whether the corresponding file still receives insertions or not.- 返回:
- the reader of the file specified by filePath.
- 抛出:
java.io.IOException
- when reader cannot be created.
-
increaseFileReaderReference
public void increaseFileReaderReference(TsFileResource tsFile, boolean isClosed)
Increase the reference count of the reader specified by filePath. Only when the reference count of a reader equals zero, the reader can be closed and removed.
-
decreaseFileReaderReference
public void decreaseFileReaderReference(TsFileResource tsFile, boolean isClosed)
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.
-
closeAndRemoveAllOpenedReaders
public void closeAndRemoveAllOpenedReaders() throws java.io.IOException
Only forEnvironmentUtils.cleanEnv
method. To make sure that unit tests and integration tests will not conflict with each other.- 抛出:
java.io.IOException
-
contains
public boolean contains(TsFileResource tsFile, boolean isClosed)
This method is only for unit tests.
-
writeFileReferenceInfo
public void writeFileReferenceInfo()
-
getClosedFileReaderMap
public java.util.Map<java.lang.String,org.apache.iotdb.tsfile.read.TsFileSequenceReader> getClosedFileReaderMap()
-
getUnclosedFileReaderMap
public java.util.Map<java.lang.String,org.apache.iotdb.tsfile.read.TsFileSequenceReader> getUnclosedFileReaderMap()
-
-