]> git.argeo.org Git - lgpl/argeo-commons.git/blobdiff - org.argeo.api.uuid/src/org/argeo/api/uuid/ConcurrentTimeUuidState.java
Merge remote-tracking branch 'origin/unstable' into merge-to-testing
[lgpl/argeo-commons.git] / org.argeo.api.uuid / src / org / argeo / api / uuid / ConcurrentTimeUuidState.java
index 8131df8eebbd0bfdb9dad16e9210b64b84a1ea88..fd158fb8315db647b8d0b07e7790d1ec57aa2b3f 100644 (file)
@@ -9,6 +9,7 @@ import java.util.Map;
 import java.util.Objects;
 import java.util.Set;
 import java.util.WeakHashMap;
+import java.util.concurrent.ForkJoinPool;
 import java.util.concurrent.atomic.AtomicLong;
 
 import org.argeo.api.uuid.UuidFactory.TimeUuidState;
@@ -21,7 +22,7 @@ import org.argeo.api.uuid.UuidFactory.TimeUuidState;
  * sequences. If that limit is reached, the clock sequence which has not be used
  * for the most time is reallocated to the new thread. It is assumed that the
  * context where time uUIDs will be generated will often be using thread pools
- * (e.g. {@link ForkJoinPool#commonPool(), http server, database access, etc.)
+ * (e.g. {@link ForkJoinPool#commonPool()}, http server, database access, etc.)
  * and that such reallocation won't have to happen too often.
  */
 public class ConcurrentTimeUuidState implements UuidFactory.TimeUuidState {
@@ -142,9 +143,7 @@ public class ConcurrentTimeUuidState implements UuidFactory.TimeUuidState {
        @Override
        public long getMostSignificantBits() {
                long timestamp = useTimestamp();
-               long mostSig = UuidFactory.MOST_SIG_VERSION1 | ((timestamp & 0xFFFFFFFFL) << 32) // time_low
-                               | (((timestamp >> 32) & 0xFFFFL) << 16) // time_mid
-                               | ((timestamp >> 48) & 0x0FFFL);// time_hi_and_version
+               long mostSig = TimeUuid.toMostSignificantBits(timestamp);
                return mostSig;
        }