Package ubic.gemma.core.util.locking
Class FileLockManagerImpl
java.lang.Object
ubic.gemma.core.util.locking.FileLockManagerImpl
- All Implemented Interfaces:
FileLockManager
- Author:
- poirigui
-
Constructor Summary
Constructors -
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.
-
Constructor Details
-
FileLockManagerImpl
public FileLockManagerImpl()
-
-
Method Details
-
getAllLockInfos
Description copied from interface:FileLockManagerGet the lock info for all paths known to the lock manager.- Specified by:
getAllLockInfosin interfaceFileLockManager- Throws:
IOException
-
getAllLockInfosByWalking
public Stream<FileLockInfo> getAllLockInfosByWalking(Path directory, int maxDepth) throws IOException Description copied from interface:FileLockManagerGet the lock info for all paths obtained by walking the given directory.- Specified by:
getAllLockInfosByWalkingin interfaceFileLockManager- Throws:
IOException
-
getLockInfo
Description copied from interface:FileLockManagerGet the lock info for a given path.- Specified by:
getLockInfoin interfaceFileLockManager- Throws:
IOException
-
acquirePathLock
Description copied from interface:FileLockManagerLock a given path.- Specified by:
acquirePathLockin interfaceFileLockManager- Parameters:
path- the path to lockexclusive- make the lock exclusive for the purpose of creating of modifying the path
-
tryAcquirePathLock
public LockedPath tryAcquirePathLock(Path path, boolean exclusive, long timeout, TimeUnit timeUnit) throws TimeoutException, InterruptedException Description copied from interface:FileLockManagerAttempt to lock a path.- Specified by:
tryAcquirePathLockin interfaceFileLockManager- 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 lock
-
newInputStream
- Specified by:
newInputStreamin interfaceFileLockManager- Throws:
IOException- See Also:
-
newBufferedReader
- Specified by:
newBufferedReaderin interfaceFileLockManager- Throws:
IOException- See Also:
-
newOutputStream
- Specified by:
newOutputStreamin interfaceFileLockManager- Throws:
IOException- See Also:
-
newBufferedWriter
- Specified by:
newBufferedWriterin interfaceFileLockManager- Throws:
IOException- See Also:
-