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
FieldsModifier and TypeFieldDescription -
Method Summary
Modifier and TypeMethodDescriptionvoidcloseAll()intstatic TrackedFileHandleFactoryintgetSize()doubleintfinal @NotNull FileHandlemakeHandle(@NotNull File file, @NotNull OpenOption[] openOptions) Create a newFileHandlewith the specified set ofOpenOptions.voidshutdown()
-
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:FileHandleFactoryCreate a newFileHandlewith the specified set ofOpenOptions.- Specified by:
makeHandlein interfaceFileHandleFactory- Parameters:
file- TheFileto openopenOptions- TheOpenOptions to use- Returns:
- The new file handle
- Throws:
IOException
-
closeAll
public void closeAll() -
shutdown
public void shutdown()
-