Package org.terracotta.utilities.io
Class FilesSupport.PathHolder
java.lang.Object
org.terracotta.utilities.io.FilesSupport.PathHolder
- All Implemented Interfaces:
AutoCloseable
- Enclosing class:
- FilesSupport
Support class to open or lock a file for file operation impact assessment.
Although this class has "support" for opening a directory, there appears to be no reliable means in Java of opening a directory and observing the impact on other file operations.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
LOGGER
private static final org.slf4j.Logger LOGGER -
thread
-
barrier
-
started
-
-
Constructor Details
-
PathHolder
- Throws:
IOException
-
-
Method Details
-
holdFile
Holds open a file for read.- Parameters:
file- the file path to hold open
-
lockFile
Holds a lock on a file.- Parameters:
file- the file path to lock
-
holdDirectory
-
start
public void start()Open or lock the file and return. The file remains opened or locked untilclose()is called. -
close
public void close()Closes and unlocks the file.- Specified by:
closein interfaceAutoCloseable
-