Interface MachineIdDistribute

All Known Subinterfaces:
MachineIdDistributor
All Known Implementing Classes:
AbstractMachineIdDistributor, GuardDistribute, JdbcMachineIdDistributor, ManualMachineIdDistributor, MongoMachineIdDistributor, ProxyMachineIdDistributor, SpringRedisMachineIdDistributor, StatefulSetMachineIdDistributor, ZookeeperMachineIdDistributor

public interface MachineIdDistribute
  • Method Summary

    Modifier and Type
    Method
    Description
    @NonNull MachineState
    distribute(String namespace, int machineBit, InstanceId instanceId, Duration safeGuardDuration)
    Distribute (allocate) a machine ID within the specified namespace.
  • Method Details

    • distribute

      @NonNull MachineState distribute(String namespace, int machineBit, InstanceId instanceId, Duration safeGuardDuration) throws MachineIdOverflowException
      Distribute (allocate) a machine ID within the specified namespace.

      This method allocates a unique machine ID for the given instance within the specified namespace. The allocated ID is guaranteed to be unique within that namespace for the duration of its lease.

      The method returns a MachineState object containing the allocated machine ID and associated metadata.

      Parameters:
      namespace - The namespace for machine ID allocation
      machineBit - The number of bits to use for machine IDs
      instanceId - The instance identifier requesting the machine ID
      safeGuardDuration - The duration for safe guarding the allocation
      Returns:
      The machine state containing the allocated machine ID
      Throws:
      MachineIdOverflowException - if no more machine IDs are available