Class Sonyflake
java.lang.Object
icu.congee.id.generator.sonyflake.Sonyflake
Sonyflake ID生成器
基于Sony的分布式ID生成算法实现,生成的ID由以下部分组成: - 39位时间戳 - 8位序列号 - 16位机器ID
- Since:
- 1.0.0
- Author:
- congee
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class无效机器ID异常static interfacestatic interfacestatic class无法获取私有IP地址异常static class时间超限异常static classstatic class -
Method Summary
Modifier and TypeMethodDescriptiondecompose(long id) static longelapsedTime(long id) static longmachineID(long id) static Sonyflakestatic SonyflakelongnextID()static longsequenceNumber(long id)
-
Method Details
-
newInstance
public static Sonyflake newInstance(Sonyflake.Settings st) throws Sonyflake.StartTimeAheadException, Sonyflake.NoPrivateAddressException, Sonyflake.InvalidMachineIDException -
newSonyflake
-
nextID
- Throws:
Sonyflake.OverTimeLimitException
-
elapsedTime
public static long elapsedTime(long id) -
sequenceNumber
public static long sequenceNumber(long id) -
machineID
public static long machineID(long id) -
decompose
-