Interface FileLockManager
- All Known Implementing Classes:
FileLockManagerImpl
public interface FileLockManager
Create shared and exclusive locks for files.
All file locking within Gemma should be mediated by this class.
- Author:
- poirigui
-
Method Summary
Modifier and TypeMethodDescriptionacquirePathLock(Path path, boolean exclusive) Lock a given path.Get the lock info for all paths known to the lock manager.getAllLockInfosByWalking(Path directory, int maxDepth) Get the lock info for all paths obtained by walking the given directory.getLockInfo(Path path) Get the lock info for a given path.newBufferedReader(Path path) newBufferedWriter(Path path, OpenOption... openOptions) newInputStream(Path path, OpenOption... openOptions) newOutputStream(Path path, OpenOption... openOptions) tryAcquirePathLock(Path path, boolean exclusive, long timeout, TimeUnit timeUnit) Attempt to lock a path.
-
Method Details
-
getAllLockInfos
Get the lock info for all paths known to the lock manager.- Throws:
IOException
-
getAllLockInfosByWalking
Get the lock info for all paths obtained by walking the given directory.- Throws:
IOException
-
getLockInfo
Get the lock info for a given path.- Throws:
IOException
-
acquirePathLock
Lock a given path.- Parameters:
path- the path to lockexclusive- make the lock exclusive for the purpose of creating of modifying the path- Throws:
IOException
-
tryAcquirePathLock
LockedPath tryAcquirePathLock(Path path, boolean exclusive, long timeout, TimeUnit timeUnit) throws IOException, TimeoutException, InterruptedException Attempt to lock a path.- Parameters:
path- the path to lockexclusive- make the lock exclusive for the purpose of creating of modifying the path- Throws:
TimeoutException- if the lock acquisition timed outInterruptedException- if the thread was interrupted while waiting for the lockIOException
-
newInputStream
- Throws:
IOException- See Also:
-
newBufferedReader
- Throws:
IOException- See Also:
-
newOutputStream
- Throws:
IOException- See Also:
-
newBufferedWriter
- Throws:
IOException- See Also:
-