Package io.deephaven.kv.etcd.lease
Interface DeephavenLease
- All Superinterfaces:
com.fishlib.base.log.LogOutputAppendable
- All Known Implementing Classes:
DeephavenLeaseImpl
public interface DeephavenLease
extends com.fishlib.base.log.LogOutputAppendable
Encapsulates a lease value with associated timeouts that can be used by a client to manage the lease. Leases are a
mechanism for detecting client liveness. The leasing service grants leases with a time-to-live. A lease expires if it
is not renewed within a given TTL period. The data or service represented by a canceled lease may be deleted or
stopped.
-
Method Summary
Modifier and TypeMethodDescription@NotNull StringReturns the identifier used to store data.longReturns a long value identifying the granted lease.intReturns the maximum frequency in seconds should be used to renew a lease.intReturns how often, in seconds, should the lease be renewed This must be less thangetLeaseTtlSeconds(); for safety it should be no more than 50% of the TTL value.intReturns the Time to live of the lease in seconds.booleanrenew()Renew the lease for the associated leaseId.voidrevoke()Revoke the lease for the associated leaseId.Methods inherited from interface com.fishlib.base.log.LogOutputAppendable
append
-
Method Details
-
getLeaseId
long getLeaseId()Returns a long value identifying the granted lease. -
getDataIdentifier
Returns the identifier used to store data. -
renew
Renew the lease for the associated leaseId.- Returns:
- Returns true if renewal is successful, false if renewal fails due to lease not found.
- Throws:
DeephavenLeaseException- if renewal fails for reason other than lease not found.
-
revoke
Revoke the lease for the associated leaseId. The data or service represented by a revoked lease will be deleted or stopped.- Throws:
DeephavenLeaseException- when revoke fails for any reason, common reasons being one of theseInterruptedException,ExecutionException,TimeoutExceptionorIOException
-
getLeaseTtlSeconds
int getLeaseTtlSeconds()Returns the Time to live of the lease in seconds. This is the time the lease will be active from the start or from the time it was last renewed. If not renewed within this timeframe backing store will automatically revoke the lease. -
getLeaseRenewSeconds
int getLeaseRenewSeconds()Returns how often, in seconds, should the lease be renewed This must be less thangetLeaseTtlSeconds(); for safety it should be no more than 50% of the TTL value. -
getLeaseRenewRetryDelaySeconds
int getLeaseRenewRetryDelaySeconds()Returns the maximum frequency in seconds should be used to renew a lease. If a lease renewal times out, then try again more quickly than the standardgetLeaseRenewSeconds();.
-