Class FlakeId

java.lang.Object
icu.congee.id.generator.flakeid.FlakeId

public class FlakeId extends Object
Flake ID 生成器在分布式环境中生成 k 有序、无冲突的 ID。
  • Constructor Details

    • FlakeId

      public FlakeId(FlakeId.Options options)
      表示一个 ID 生成器。
      Parameters:
      options - 生成器选项
  • Method Details

    • next

      public byte[] next() throws Exception
      生成无冲突的 ID
      Returns:
      生成的 ID
      Throws:
      Exception - 如果时钟回拨或者序列超过其最大值