Package ubic.gemma.core.util.locking
Interface LockedPath
- All Superinterfaces:
AutoCloseable
A locked path.
- Author:
- poirigui
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Release the lock.Release the lock and obtain the underlyingPath
object.getPath()
Retrieve the path being locked.boolean
isShared()
Indicate if the lock is shared.boolean
isValid()
Indicate if the lock is valid.steal()
Steal this lock.stealWithPath
(Path path) Steal this lock with a different path.Convert this lock to an exclusive lock.toExclusive
(long timeout, TimeUnit timeUnit) Try to convert this lock to an exclusive lock.toShared()
Convert this lock to a shared lock.
-
Method Details
-
getPath
Path getPath()Retrieve the path being locked. -
isValid
boolean isValid()Indicate if the lock is valid. -
close
void close()Release the lock.This does nothing if the lock is already closed or stolen.
- Specified by:
close
in interfaceAutoCloseable
-
closeAndGetPath
Release the lock and obtain the underlyingPath
object.This does nothing if the lock is already closed or stolen.
-
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
-
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
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
-