Class ResourceLockImpl<T>
- java.lang.Object
-
- org.apache.pulsar.metadata.coordination.impl.ResourceLockImpl<T>
-
- All Implemented Interfaces:
ResourceLock<T>
public class ResourceLockImpl<T> extends java.lang.Object implements ResourceLock<T>
-
-
Constructor Summary
Constructors Constructor Description ResourceLockImpl(MetadataStoreExtended store, MetadataSerde<T> serde, java.lang.String path)
-
Method Summary
All Methods Instance Methods Concrete 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()inthashCode()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.
-
-
-
Constructor Detail
-
ResourceLockImpl
public ResourceLockImpl(MetadataStoreExtended store, MetadataSerde<T> serde, java.lang.String path)
-
-
Method Detail
-
getValue
public T getValue()
- Specified by:
getValuein interfaceResourceLock<T>- Returns:
- the value associated with the lock
-
updateValue
public java.util.concurrent.CompletableFuture<java.lang.Void> updateValue(T newValue)
Description copied from interface:ResourceLockUpdate the value of the lock.- Specified by:
updateValuein interfaceResourceLock<T>- Returns:
- a future to track when the release operation is complete
-
release
public java.util.concurrent.CompletableFuture<java.lang.Void> release()
Description copied from interface:ResourceLockRelease the lock on the resource.- Specified by:
releasein interfaceResourceLock<T>- Returns:
- a future to track when the release operation is complete
-
getLockExpiredFuture
public java.util.concurrent.CompletableFuture<java.lang.Void> getLockExpiredFuture()
Description copied from interface:ResourceLockGet a future that can be used to get notified when the lock is expired or it gets released.- Specified by:
getLockExpiredFuturein interfaceResourceLock<T>- Returns:
- a future to get notification if the lock is expired
-
getPath
public java.lang.String getPath()
- Specified by:
getPathin interfaceResourceLock<T>- Returns:
- the path associated with the lock
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
-