public final class EtcdLeaseClient extends Object implements LeaseClient, Closeable
LeaseClient.FluentGrantRequest, LeaseClient.FluentMaintainRequest| Modifier and Type | Field and Description |
|---|---|
protected Set<com.ibm.etcd.client.lease.EtcdLeaseClient.LeaseRecord> |
allLeases |
protected static int |
DEFAULT_INTERVAL_SECS |
protected static int |
DEFAULT_MIN_EXPIRY_SECS |
protected LeaseKeepAliveRequest.Builder |
KAR_BUILDER |
protected Executor |
kaReqExecutor |
protected io.grpc.stub.StreamObserver<LeaseKeepAliveRequest> |
kaReqStream |
protected int |
leaseCount |
protected ConcurrentMap<Long,com.ibm.etcd.client.lease.EtcdLeaseClient.LeaseRecord> |
leaseMap |
protected static int |
MIN_INTERVAL_SECS |
protected static int |
MIN_MIN_EXPIRY_SECS |
protected ConcurrentMap<Long,List<com.ibm.etcd.client.lease.EtcdLeaseClient.KeepAliveFuture>> |
oneTimeMap |
protected Executor |
respExecutor |
protected GrpcClient.ResilientResponseObserver<LeaseKeepAliveRequest,LeaseKeepAliveResponse> |
responseObserver |
| Constructor and Description |
|---|
EtcdLeaseClient(GrpcClient client) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
com.google.common.util.concurrent.ListenableFuture<LeaseGrantResponse> |
create(long leaseId,
long ttlSecs)
Deprecated.
|
LeaseClient.FluentGrantRequest |
grant(long ttlSecs)
Start a fluent grant request for "one time" lease establishment.
|
com.google.common.util.concurrent.ListenableFuture<LeaseKeepAliveResponse> |
keepAliveOnce(long leaseId) |
protected void |
leaseClosed(com.ibm.etcd.client.lease.EtcdLeaseClient.LeaseRecord rec) |
com.google.common.util.concurrent.ListenableFuture<LeaseLeasesResponse> |
list()
List all existing leases
Supported in versions >= 3.3 only
|
LeaseClient.FluentMaintainRequest |
maintain()
Maintain a "persistent" lease.
|
protected PersistentLease |
newPersisentLease(long leaseId,
int minExpirySecs,
int keepAliveFreqSecs,
io.grpc.stub.StreamObserver<PersistentLease.LeaseState> observer,
Executor executor,
boolean protect) |
com.google.common.util.concurrent.ListenableFuture<LeaseRevokeResponse> |
revoke(long leaseId) |
com.google.common.util.concurrent.ListenableFuture<LeaseRevokeResponse> |
revoke(long leaseId,
boolean ensureWithRetries) |
protected void |
sendKeepAlive(long leaseId) |
com.google.common.util.concurrent.ListenableFuture<LeaseTimeToLiveResponse> |
ttl(long leaseId,
boolean includeKeys) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcreate, ttlprotected static final int MIN_MIN_EXPIRY_SECS
protected static final int MIN_INTERVAL_SECS
protected static final int DEFAULT_MIN_EXPIRY_SECS
protected static final int DEFAULT_INTERVAL_SECS
protected final LeaseKeepAliveRequest.Builder KAR_BUILDER
protected io.grpc.stub.StreamObserver<LeaseKeepAliveRequest> kaReqStream
protected int leaseCount
protected final Executor kaReqExecutor
protected final Executor respExecutor
protected final Set<com.ibm.etcd.client.lease.EtcdLeaseClient.LeaseRecord> allLeases
protected final ConcurrentMap<Long,com.ibm.etcd.client.lease.EtcdLeaseClient.LeaseRecord> leaseMap
protected final ConcurrentMap<Long,List<com.ibm.etcd.client.lease.EtcdLeaseClient.KeepAliveFuture>> oneTimeMap
protected final GrpcClient.ResilientResponseObserver<LeaseKeepAliveRequest,LeaseKeepAliveResponse> responseObserver
public EtcdLeaseClient(GrpcClient client)
@Deprecated public com.google.common.util.concurrent.ListenableFuture<LeaseGrantResponse> create(long leaseId, long ttlSecs)
create in interface LeaseClientLeaseGrantResponsepublic LeaseClient.FluentGrantRequest grant(long ttlSecs)
LeaseClientPersistentLease
via the LeaseClient.maintain() method.grant in interface LeaseClientpublic com.google.common.util.concurrent.ListenableFuture<LeaseRevokeResponse> revoke(long leaseId)
revoke in interface LeaseClientLeaseRevokeResponsepublic com.google.common.util.concurrent.ListenableFuture<LeaseRevokeResponse> revoke(long leaseId, boolean ensureWithRetries)
revoke in interface LeaseClientensureWithRetries - if true, the asynchronous request will be retried
continuously in the background after connection failures (between back-off pauses)LeaseRevokeResponsepublic com.google.common.util.concurrent.ListenableFuture<LeaseTimeToLiveResponse> ttl(long leaseId, boolean includeKeys)
ttl in interface LeaseClientLeaseTimeToLiveResponsepublic com.google.common.util.concurrent.ListenableFuture<LeaseKeepAliveResponse> keepAliveOnce(long leaseId)
keepAliveOnce in interface LeaseClientLeaseKeepAliveResponsepublic com.google.common.util.concurrent.ListenableFuture<LeaseLeasesResponse> list()
LeaseClientSupported in versions >= 3.3 only
list in interface LeaseClientLeaseLeasesResponsepublic LeaseClient.FluentMaintainRequest maintain()
LeaseClientPersistentLease object.
Specifying a lease id is optional. If not provided it will be server-assigned.
The return PersistentLease is also a future, which will be completed
with the lease id when it is granted/confirmed.
NOTE sole "ownership" of the lease is assumed - i.e. the lease should not be revoked elsewhere.
maintain in interface LeaseClientprotected PersistentLease newPersisentLease(long leaseId, int minExpirySecs, int keepAliveFreqSecs, io.grpc.stub.StreamObserver<PersistentLease.LeaseState> observer, Executor executor, boolean protect)
protected void leaseClosed(com.ibm.etcd.client.lease.EtcdLeaseClient.LeaseRecord rec)
protected void sendKeepAlive(long leaseId)
public void close()
close in interface Closeableclose in interface AutoCloseableCopyright © 2022. All rights reserved.