Package ubic.gemma.core.util.locking
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
All Methods Instance Methods Abstract Methods Modifier and Type Method Description LockedPath
acquirePathLock(Path path, boolean exclusive)
Lock a given path.Collection<FileLockInfo>
getAllLockInfos()
Get the lock info for all paths known to the lock manager.Stream<FileLockInfo>
getAllLockInfosByWalking(Path directory, int maxDepth)
Get the lock info for all paths obtained by walking the given directory.FileLockInfo
getLockInfo(Path path)
Get the lock info for a given path.Reader
newBufferedReader(Path path)
Writer
newBufferedWriter(Path path, OpenOption... openOptions)
InputStream
newInputStream(Path path, OpenOption... openOptions)
OutputStream
newOutputStream(Path path, OpenOption... openOptions)
LockedPath
tryAcquirePathLock(Path path, boolean exclusive, long timeout, TimeUnit timeUnit)
Attempt to lock a path.
-
-
-
Method Detail
-
getAllLockInfos
Collection<FileLockInfo> getAllLockInfos() throws IOException
Get the lock info for all paths known to the lock manager.- Throws:
IOException
-
getAllLockInfosByWalking
Stream<FileLockInfo> getAllLockInfosByWalking(Path directory, int maxDepth) throws IOException
Get the lock info for all paths obtained by walking the given directory.- Throws:
IOException
-
getLockInfo
FileLockInfo getLockInfo(Path path) throws IOException
Get the lock info for a given path.- Throws:
IOException
-
acquirePathLock
LockedPath acquirePathLock(Path path, boolean exclusive) throws IOException
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
InputStream newInputStream(Path path, OpenOption... openOptions) throws IOException
- Throws:
IOException
- See Also:
Files.newInputStream(Path, OpenOption...)
-
newBufferedReader
Reader newBufferedReader(Path path) throws IOException
- Throws:
IOException
- See Also:
Files.newBufferedReader(Path)
-
newOutputStream
OutputStream newOutputStream(Path path, OpenOption... openOptions) throws IOException
- Throws:
IOException
- See Also:
Files.newOutputStream(Path, OpenOption...)
-
newBufferedWriter
Writer newBufferedWriter(Path path, OpenOption... openOptions) throws IOException
- Throws:
IOException
- See Also:
(Path)
-
-