Class FileLockUtils
java.lang.Object
org.aksw.commons.lock.FileLockUtils
Similar to
ProcessFileLock-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Ref<FileChannel> open(Path path, boolean readLockRequested, OpenOption... openOptions) Request an exclusive file channel.
-
Constructor Details
-
FileLockUtils
public FileLockUtils()
-
-
Method Details
-
open
public static Ref<FileChannel> open(Path path, boolean readLockRequested, OpenOption... openOptions) throws IOException, InterruptedException Request an exclusive file channel. The reference to the channel can be shared among several threads, but the channel itself exists only once. Do not directly close the FileChannel! Always close the reference as this also releases locks.- Parameters:
path-readLockRequested-openOptions-- Returns:
- Throws:
IOExceptionInterruptedException
-