|
|
@ -80,7 +80,7 @@ public class IdWorker {
|
|
|
|
public synchronized long nextId() {
|
|
|
|
public synchronized long nextId() {
|
|
|
|
long timestamp = timeGen();
|
|
|
|
long timestamp = timeGen();
|
|
|
|
if (timestamp < lastTimestamp) {
|
|
|
|
if (timestamp < lastTimestamp) {
|
|
|
|
throw new BizException(String.format("Clock moved backwards. Refusing to generate id for %d milliseconds", lastTimestamp - timestamp));
|
|
|
|
throw new RuntimeException(String.format("Clock moved backwards. Refusing to generate id for %d milliseconds", lastTimestamp - timestamp));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (lastTimestamp == timestamp) {
|
|
|
|
if (lastTimestamp == timestamp) {
|
|
|
|