diff --git a/misc/log4j2.component.properties_bak b/misc/log4j2.component.properties_bak deleted file mode 100644 index be81378..0000000 --- a/misc/log4j2.component.properties_bak +++ /dev/null @@ -1,2 +0,0 @@ -log4j2.contextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector -log4j2.asyncLoggerWaitStrategy=Sleep \ No newline at end of file diff --git a/pom.xml b/pom.xml index 32f8f85..79ea6b6 100644 --- a/pom.xml +++ b/pom.xml @@ -5,11 +5,12 @@ org.springframework.boot spring-boot-starter-parent - 2.4.5 + 2.5.2 + com.stun4j stun4j-guid - 1.1.2 + 1.1.3 Stun4J Guid Global unique id generator,distributed,ultra fast,easy to use @@ -75,7 +76,8 @@ 2.14.1 3.12.0 30.1.1-jre - 3.4.3 + 3.4.4 + 4.2.3 diff --git a/src/main/java/com/stun4j/guid/LocalGuid.java b/src/main/java/com/stun4j/guid/LocalGuid.java index 53a9ae4..5476925 100644 --- a/src/main/java/com/stun4j/guid/LocalGuid.java +++ b/src/main/java/com/stun4j/guid/LocalGuid.java @@ -1,4 +1,4 @@ -/*- +/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. @@ -19,7 +19,6 @@ import static com.stun4j.guid.utils.Asserts.argument; import static com.stun4j.guid.utils.Asserts.notNull; import static com.stun4j.guid.utils.Asserts.state; -import static com.stun4j.guid.utils.Strings.leftPad; import static com.stun4j.guid.utils.Strings.lenientFormat; import java.security.SecureRandom; @@ -176,12 +175,7 @@ public long from(long timeMs) { } public long getTimeMsFromId(long idExpectingSameEpoch) { - // assume the id is an unsigned num - String binStr = Long.toUnsignedString(idExpectingSameEpoch, 2); - binStr = leftPad(binStr, 64, "0"); - String timeDeltaStr = binStr.substring(1, 42); - long back = Long.valueOf(timeDeltaStr, 2); - return back + this.epoch; + return (idExpectingSameEpoch >> timestampLeftShift & ~(-1L << 41L)) + this.epoch; } // <-