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 Type
    Method
    Description
    @NotNull String
    Returns the identifier used to store data.
    long
    Returns a long value identifying the granted lease.
    int
    Returns the maximum frequency in seconds should be used to renew a lease.
    int
    Returns how often, in seconds, should the lease be renewed This must be less than getLeaseTtlSeconds(); for safety it should be no more than 50% of the TTL value.
    int
    Returns the Time to live of the lease in seconds.
    boolean
    Renew the lease for the associated leaseId.
    void
    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

      @NotNull @NotNull String getDataIdentifier()
      Returns the identifier used to store data.
    • renew

      boolean renew() throws DeephavenLeaseException
      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

      void revoke() throws DeephavenLeaseException
      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 these InterruptedException, ExecutionException, TimeoutException or IOException
    • 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 than getLeaseTtlSeconds(); 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 standard getLeaseRenewSeconds();.