public class IdUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static IdUtils |
getInstance() |
long |
nextId()
获得下一个ID (该方法是线程安全的)
|
long |
now()
返回以毫秒为单位的当前时间
|
protected long |
tilNextMillis(long lastTimestamp)
阻塞到下一个毫秒,直到获得新的时间戳
|
public static IdUtils getInstance()
public long nextId()
protected long tilNextMillis(long lastTimestamp)
lastTimestamp - 上次生成ID的时间截public long now()
Copyright © 2022. All rights reserved.