Package ubic.gemma.core.util.locking
Class FileLockManagerImpl
- java.lang.Object
-
- ubic.gemma.core.util.locking.FileLockManagerImpl
-
- All Implemented Interfaces:
FileLockManager
@Component public class FileLockManagerImpl extends Object implements FileLockManager
- Author:
- poirigui
-
-
Constructor Summary
Constructors Constructor Description FileLockManagerImpl()
-
Method Summary
All Methods Instance Methods Concrete 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.LockedPath
tryAcquirePathLock(Path path, boolean exclusive, long timeout, TimeUnit timeUnit)
Attempt to lock a path.
-
-
-
Method Detail
-
getAllLockInfos
public Collection<FileLockInfo> getAllLockInfos() throws IOException
Description copied from interface:FileLockManager
Get the lock info for all paths known to the lock manager.- Specified by:
getAllLockInfos
in interfaceFileLockManager
- Throws:
IOException
-
getAllLockInfosByWalking
public Stream<FileLockInfo> getAllLockInfosByWalking(Path directory, int maxDepth) throws IOException
Description copied from interface:FileLockManager
Get the lock info for all paths obtained by walking the given directory.- Specified by:
getAllLockInfosByWalking
in interfaceFileLockManager
- Throws:
IOException
-
getLockInfo
public FileLockInfo getLockInfo(Path path) throws IOException
Description copied from interface:FileLockManager
Get the lock info for a given path.- Specified by:
getLockInfo
in interfaceFileLockManager
- Throws:
IOException
-
acquirePathLock
public LockedPath acquirePathLock(Path path, boolean exclusive)
Description copied from interface:FileLockManager
Lock a given path.- Specified by:
acquirePathLock
in 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:FileLockManager
Attempt to lock a path.- Specified by:
tryAcquirePathLock
in 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
-
-