Class MGL_SnowflakeIdGenerator

java.lang.Object
tech.mgl.core.utils.id.MGL_SnowflakeIdGenerator

public class MGL_SnowflakeIdGenerator extends Object
  • Constructor Details

    • MGL_SnowflakeIdGenerator

      public MGL_SnowflakeIdGenerator(long workerId, long dataCenterId)
      构造函数
      Parameters:
      workerId - 工作ID (0~31)
      dataCenterId - 数据中心ID (0~31)
    • MGL_SnowflakeIdGenerator

      public MGL_SnowflakeIdGenerator(long workerId, long dataCenterId, long startTime)
      可以设定启动时间,每个系统应该固定一个启动时间
      Parameters:
      workerId -
      dataCenterId -
      startTime -
    • MGL_SnowflakeIdGenerator

      public MGL_SnowflakeIdGenerator()
  • Method Details

    • nextId

      public long nextId(boolean newIdEveryDay)
    • nextId

      public long nextId()
      Returns: