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
Modifier and TypeMethodDescriptionGet a future that can be used to get notified when the lock is expired or it gets released.getPath()getValue()release()Release the lock on the resource.updateValue(T newValue) Update the value of the lock.
-
Method Details
-
getPath
String getPath()- Returns:
- the path associated with the lock
-
getValue
T getValue()- Returns:
- the value associated with the lock
-
updateValue
Update the value of the lock.- Returns:
- a future to track when the release operation is complete
-
release
CompletableFuture<Void> release()Release the lock on the resource.- Returns:
- a future to track when the release operation is complete
-
getLockExpiredFuture
CompletableFuture<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
-