Interface ResourceLock<T>
-
- All Known Implementing Classes:
ResourceLockImpl
public interface ResourceLock<T>Represent a lock that the current process has on a shared resource.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.util.concurrent.CompletableFuture<java.lang.Void>getLockExpiredFuture()Get a future that can be used to get notified when the lock is expired or it gets released.java.lang.StringgetPath()TgetValue()java.util.concurrent.CompletableFuture<java.lang.Void>release()Release the lock on the resource.java.util.concurrent.CompletableFuture<java.lang.Void>updateValue(T newValue)Update the value of the lock.
-
-
-
Method Detail
-
getPath
java.lang.String getPath()
- Returns:
- the path associated with the lock
-
getValue
T getValue()
- Returns:
- the value associated with the lock
-
updateValue
java.util.concurrent.CompletableFuture<java.lang.Void> updateValue(T newValue)
Update the value of the lock.- Returns:
- a future to track when the release operation is complete
-
release
java.util.concurrent.CompletableFuture<java.lang.Void> release()
Release the lock on the resource.- Returns:
- a future to track when the release operation is complete
-
getLockExpiredFuture
java.util.concurrent.CompletableFuture<java.lang.Void> getLockExpiredFuture()
Get a future that can be used to get notified when the lock is expired or it gets released.- Returns:
- a future to get notification if the lock is expired
-
-