Package ubic.gemma.core.util.locking
Interface LockedPath
-
- All Superinterfaces:
AutoCloseable
public interface LockedPath extends AutoCloseable
A locked path.- Author:
- poirigui
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
close()
Release the lock.Path
closeAndGetPath()
Release the lock and obtain the underlyingPath
object.Path
getPath()
Retrieve the path being locked.boolean
isShared()
Indicate if the lock is shared.boolean
isValid()
Indicate if the lock is valid.LockedPath
steal()
Steal this lock.LockedPath
stealWithPath(Path path)
Steal this lock with a different path.LockedPath
toExclusive()
Convert this lock to an exclusive lock.LockedPath
toExclusive(long timeout, TimeUnit timeUnit)
Try to convert this lock to an exclusive lock.LockedPath
toShared()
Convert this lock to a shared lock.
-
-
-
Method Detail
-
getPath
Path getPath()
Retrieve the path being locked.
-
isValid
boolean isValid()
Indicate if the lock is valid.
-
isShared
boolean isShared()
Indicate if the lock is shared.
-
close
void close()
Release the lock.This does nothing if the lock is already closed or stolen.
- Specified by:
close
in interfaceAutoCloseable
-
closeAndGetPath
@WillClose Path closeAndGetPath()
Release the lock and obtain the underlyingPath
object.This does nothing if the lock is already closed or stolen.
-
toExclusive
@WillClose LockedPath toExclusive()
Convert this lock to an exclusive lock.This lock will be closed as a result.
- Throws:
IllegalStateException
- if this lock is already exclusive or no longer valid
-
toExclusive
@WillClose LockedPath toExclusive(long timeout, TimeUnit timeUnit) throws InterruptedException, TimeoutException
Try to convert this lock to an exclusive lock.This lock will be closed as a result.
- Throws:
IllegalStateException
- if this lock is already exclusive or no longer validInterruptedException
TimeoutException
-
toShared
@WillClose LockedPath toShared()
Convert this lock to a shared lock.This lock will be closed as a result.
- Throws:
IllegalStateException
- if this lock is already shared or no longer valid
-
steal
@WillClose LockedPath steal()
Steal this lock.Once stolen, this lock will no-longer be released when closed.
- Throws:
IllegalStateException
- if this lock is already stolen or no longer valid
-
stealWithPath
@WillClose LockedPath stealWithPath(Path path)
Steal this lock with a different path. The lock will still be held on the original path, but will indicate a different path.- Throws:
IllegalStateException
- if this lock is already stolen or no longer valid
-
-