public abstract class AbstractSequence extends Object
| Modifier and Type | Field and Description |
|---|---|
protected long |
lastTimestamp
上次生成ID的时间截
|
| Constructor and Description |
|---|
AbstractSequence() |
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
checkLastTimestamp(long timestamp) |
abstract long |
nextId()
获取一个long类型的id
|
abstract String |
nextIdString()
获取一个String类型的id
|
protected long |
tilNextMillis(long lastTimestamp)
阻塞到下一个毫秒,直到获得新的时间戳
|
protected long |
timeGen()
返回以毫秒为单位的当前时间
|
public abstract String nextIdString()
public abstract long nextId()
protected boolean checkLastTimestamp(long timestamp)
protected long tilNextMillis(long lastTimestamp)
lastTimestamp - 上次生成ID的时间截protected long timeGen()
Copyright © 2021 Clouds Studio. All rights reserved.