public class PersistentLeaseKey extends com.google.common.util.concurrent.AbstractFuture<com.google.protobuf.ByteString> implements AutoCloseable
Can be optionally associated with a RangeCache within whose range the
key lies. Doing so helps to ensure local state consistency between the two.
Closing the PersistentLeaseKey will always delete the associated
key-value.
| Modifier and Type | Field and Description |
|---|---|
protected com.google.common.util.concurrent.SettableFuture<Object> |
closeFuture |
protected com.google.protobuf.ByteString |
key |
protected boolean |
leaseActive |
protected ListenerObserver<PersistentLease.LeaseState> |
stateObserver |
protected com.google.common.util.concurrent.ListenableFuture<?> |
updateFuture |
| Constructor and Description |
|---|
PersistentLeaseKey(EtcdClient client,
com.google.protobuf.ByteString key,
com.google.protobuf.ByteString defaultValue,
RangeCache rangeCache)
Create a
PersistentLeaseKey associated with the provided
client's session lease. |
PersistentLeaseKey(EtcdClient client,
PersistentLease lease,
com.google.protobuf.ByteString key,
com.google.protobuf.ByteString defaultValue,
RangeCache rangeCache) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closing deletes the key.
|
com.google.common.util.concurrent.ListenableFuture<?> |
closeWithFuture() |
protected void |
interruptTask() |
protected boolean |
isActive()
Deprecated.
|
protected void |
leaseStateChanged(boolean c,
PersistentLease.LeaseState newState,
Throwable t) |
protected void |
putKey(long leaseId) |
void |
setDefaultValue(com.google.protobuf.ByteString value)
Sets value to use if keyvalue has to be recreated, value of key on
server isn't otherwise changed
|
void |
start() |
com.google.common.util.concurrent.ListenableFuture<com.google.protobuf.ByteString> |
startWithFuture() |
protected final com.google.protobuf.ByteString key
protected final ListenerObserver<PersistentLease.LeaseState> stateObserver
protected boolean leaseActive
protected com.google.common.util.concurrent.ListenableFuture<?> updateFuture
protected com.google.common.util.concurrent.SettableFuture<Object> closeFuture
public PersistentLeaseKey(EtcdClient client, PersistentLease lease, com.google.protobuf.ByteString key, com.google.protobuf.ByteString defaultValue, RangeCache rangeCache)
client - lease - if null will use client's session leasekey - defaultValue - rangeCache - optional, may be nullpublic PersistentLeaseKey(EtcdClient client, com.google.protobuf.ByteString key, com.google.protobuf.ByteString defaultValue, RangeCache rangeCache)
PersistentLeaseKey associated with the provided
client's session lease.client - key - defaultValue - rangeCache - optional, may be nullprotected void leaseStateChanged(boolean c,
PersistentLease.LeaseState newState,
Throwable t)
@Deprecated protected boolean isActive()
public void start()
public com.google.common.util.concurrent.ListenableFuture<com.google.protobuf.ByteString> startWithFuture()
public void setDefaultValue(com.google.protobuf.ByteString value)
value - must not be nullprotected void putKey(long leaseId)
protected void interruptTask()
interruptTask in class com.google.common.util.concurrent.AbstractFuture<com.google.protobuf.ByteString>public void close()
close in interface AutoCloseablepublic com.google.common.util.concurrent.ListenableFuture<?> closeWithFuture()
Copyright © 2022. All rights reserved.