Package io.deephaven.engine.util.file
Class TrackedFileHandleFactory
java.lang.Object
io.deephaven.engine.util.file.TrackedFileHandleFactory
- All Implemented Interfaces:
FileHandleFactory
Simple least-recently-opened "cache" for FileHandles, to avoid running up against ulimits. Will probably not achieve
satisfactory results if the number of file handles concurrently in active use exceeds capacity. Note that returned
FileHandles may be closed asynchronously by the factory.
TODO: Consider adding a lookup to enable handle sharing. Not necessary for current usage.
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.deephaven.engine.util.file.FileHandleFactory
FileHandleFactory.FileToHandleFunction, FileHandleFactory.OpenOptionsHelper
-
Field Summary
Modifier and TypeFieldDescription -
Method Summary
Modifier and TypeMethodDescriptionvoid
closeAll()
int
static TrackedFileHandleFactory
int
getSize()
double
int
final @NotNull FileHandle
makeHandle
(@NotNull File file, @NotNull OpenOption[] openOptions) Create a newFileHandle
with the specified set ofOpenOption
s.void
shutdown()
-
Field Details
-
readOnlyHandleCreator
-
readWriteCreateHandleCreator
-
writeAppendCreateHandleCreator
-
writeTruncateCreateHandleCreator
-
-
Method Details
-
getInstance
-
getCapacity
public int getCapacity() -
getTargetUsageRatio
public double getTargetUsageRatio() -
getTargetUsageThreshold
public int getTargetUsageThreshold() -
getSize
public int getSize() -
makeHandle
@NotNull public final @NotNull FileHandle makeHandle(@NotNull @NotNull File file, @NotNull @NotNull OpenOption[] openOptions) throws IOException Description copied from interface:FileHandleFactory
Create a newFileHandle
with the specified set ofOpenOption
s.- Specified by:
makeHandle
in interfaceFileHandleFactory
- Parameters:
file
- TheFile
to openopenOptions
- TheOpenOption
s to use- Returns:
- The new file handle
- Throws:
IOException
-
closeAll
public void closeAll() -
shutdown
public void shutdown()
-