Commit 714cefae authored by liaozan's avatar liaozan 🏀

Update IdWorker

parent a5035bdb
......@@ -100,12 +100,16 @@ public class IdWorker {
/**
* get the timestamp (millis second) of id
*
* @param id the nextId
* @return the timestamp of id
*/
public static long getIdTimestamp(long id) {
return INSTANCE.idEpoch + (id >> timestampLeftShift);
return getIdTimestamp(id, INSTANCE);
}
/**
* get the timestamp (millis second) of id
*/
public static long getIdTimestamp(long id, IdWorker idWorker) {
return idWorker.idEpoch + (id >> timestampLeftShift);
}
private synchronized long nextId() {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment