代码语言:javascript复制
package com.nari.common.utils;
import java.util.concurrent.atomic.AtomicInteger;
public class IdUtilV2 {
private static final AtomicInteger ids = new AtomicInteger(1);
private IdUtilV2() {
}
public static String getIdStr() {
return getId().toString();
}
public static Long getId() {
return System.nanoTime() Thread.currentThread().getId() (ids.getAndIncrement());
}
}