public abstract class SnowflakeId extends java.lang.Object implements IdGenerator
| 限定符和类型 | 字段和说明 |
|---|---|
protected long |
epoch |
protected long |
lastStamp |
protected int |
machineBit |
protected int |
machineId |
protected long |
machineLeft |
protected long |
maxMachine |
protected long |
maxSequence |
protected long |
maxTimestamp |
protected long |
sequence |
protected int |
sequenceBit |
protected int |
timestampBit |
protected long |
timestampLeft |
static int |
TOTAL_BIT |
| 构造器和说明 |
|---|
SnowflakeId(long epoch,
int timestampBit,
int machineBit,
int sequenceBit,
int machineId) |
| 限定符和类型 | 方法和说明 |
|---|---|
long |
generate() |
protected abstract long |
getCurrentTime()
获取当前时间戳
|
long |
getEpoch() |
int |
getMachineBit() |
long |
getMaxMachine() |
long |
getMaxSequence() |
long |
getMaxTimestamp() |
int |
getSequenceBit() |
int |
getTimestampBit() |
protected long |
nextTime() |
public static final int TOTAL_BIT
protected final long epoch
protected final int timestampBit
protected final int machineBit
protected final int sequenceBit
protected final long maxTimestamp
protected final long maxSequence
protected final long maxMachine
protected final long machineLeft
protected final long timestampLeft
protected final int machineId
protected long sequence
protected long lastStamp
public SnowflakeId(long epoch,
int timestampBit,
int machineBit,
int sequenceBit,
int machineId)
protected long nextTime()
protected abstract long getCurrentTime()
public long generate()
generate 在接口中 IdGeneratorpublic long getEpoch()
public int getTimestampBit()
public int getMachineBit()
public int getSequenceBit()
public long getMaxTimestamp()
public long getMaxMachine()
public long getMaxSequence()