Class SlotBinding

java.lang.Object
me.ahoo.cosid.lease.SlotBinding

public final class SlotBinding extends Object
One holding of a slot and its time window (05-machine-lease.md ยง4.1). A renewal raises ceiling() in place; a new acquisition publishes a new binding with the next generation(); a lost lease invalidates the binding.

Generators keep their sequencer state per binding, so it resets with every new binding.

  • Constructor Details

    • SlotBinding

      public SlotBinding(int slot, long floor, long ceiling, long generation)
      A binding.
      Parameters:
      slot - the slot
      floor - timestamps must be strictly above it, in milliseconds
      ceiling - timestamps must be at most it, in milliseconds
      generation - counts the bindings of a SlotHandle
  • Method Details

    • slot

      public int slot()
    • floor

      public long floor()
    • ceiling

      public long ceiling()
    • generation

      public long generation()
    • isValid

      public boolean isValid()
    • raiseCeiling

      public void raiseCeiling(long newCeiling)
      Raises the ceiling after a renewal; a lower value is ignored, the ceiling never goes down.
      Parameters:
      newCeiling - the renewed ceiling
    • invalidate

      public void invalidate()
      Marks the binding lost: generators reading it throw SlotLostException.