public class SnowFlakeGenerator extends Object implements IdGenerator
+------+----------------------+----------------+-----------+
| sign | delta millisecond | worker node id | sequence |
+------+----------------------+----------------+-----------+
1bit timeBits workerBits seqBits
Note that: The total bits must be 64
| 构造器和说明 |
|---|
SnowFlakeGenerator(int timeBits,
int workerBits,
int seqBits,
long epochTimestamp,
long workerId) |
SnowFlakeGenerator(TimeUnit timeUnit,
int timeBits,
int workerBits,
int seqBits,
long epochTimestamp,
long workerId) |
public SnowFlakeGenerator(int timeBits,
int workerBits,
int seqBits,
long epochTimestamp,
long workerId)
public SnowFlakeGenerator(TimeUnit timeUnit, int timeBits, int workerBits, int seqBits, long epochTimestamp, long workerId)
public long nextId()
nextId 在接口中 IdGeneratorSnowFlakeException - in the case: Clock moved backwards; Exceeds the max timestamppublic String parse(long id)
IdGeneratorparse 在接口中 IdGeneratorCopyright © 2019. All rights reserved.