类 Sequence


  • public class Sequence
    extends java.lang.Object
    分布式高效有序 ID 生产黑科技(sequence)

    优化开源项目:https://gitee.com/yu120/sequence

    从以下版本开始:
    2016-08-18
    作者:
    hubin
    • 构造器概要

      构造器 
      构造器 说明
      Sequence​(long workerId, long datacenterId)
      有参构造器
      Sequence​(java.net.InetAddress inetAddress)  
    • 方法概要

      所有方法 实例方法 具体方法 
      修饰符和类型 方法 说明
      protected long getDatacenterId​(long maxDatacenterId)
      数据标识id部分
      protected long getMaxWorkerId​(long datacenterId, long maxWorkerId)
      获取 maxWorkerId
      long nextId()
      获取下一个 ID
      protected long tilNextMillis​(long lastTimestamp)  
      protected long timeGen()  
      • 从类继承的方法 java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 构造器详细资料

      • Sequence

        public Sequence​(java.net.InetAddress inetAddress)
      • Sequence

        public Sequence​(long workerId,
                        long datacenterId)
        有参构造器
        参数:
        workerId - 工作机器 ID
        datacenterId - 序列号
    • 方法详细资料

      • getMaxWorkerId

        protected long getMaxWorkerId​(long datacenterId,
                                      long maxWorkerId)
        获取 maxWorkerId
      • getDatacenterId

        protected long getDatacenterId​(long maxDatacenterId)
        数据标识id部分
      • nextId

        public long nextId()
        获取下一个 ID
        返回:
        下一个 ID
      • tilNextMillis

        protected long tilNextMillis​(long lastTimestamp)
      • timeGen

        protected long timeGen()