Class Lease

java.lang.Object
me.ahoo.cosid.machine.lease.Lease

@Immutable public final class Lease extends Object
A machine id held by an instance, as stored by a MachineLeaseStore.

A lease keeps three separate values:

Since:
3.4.0
  • Constructor Details

    • Lease

      public Lease(String namespace, InstanceId instanceId, int machineId, long watermark, long renewedAt, long version)
      Create a lease.
      Parameters:
      watermark - the last timestamp the machine id may have been used for
      renewedAt - the store time of the last claim or renewal
      version - the token that changes on every write
  • Method Details

    • getNamespace

      public String getNamespace()
    • getInstanceId

      public InstanceId getInstanceId()
    • isStable

      public boolean isStable()
    • getMachineId

      public int getMachineId()
    • getWatermark

      public long getWatermark()
      The last timestamp the machine id may have been used for: the owner waits until its clock passes it.
    • getRenewedAt

      public long getRenewedAt()
      The store time of the last claim or renewal: the lease expires a safe-guard duration after it.
    • getVersion

      public long getVersion()
    • toMachineState

      public MachineState toMachineState()
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object