review
This commit is contained in:
parent
a93d82d800
commit
63b455ed47
@ -2,6 +2,7 @@ package com.baeldung.timebaseduuid;
|
|||||||
|
|
||||||
import com.github.f4b6a3.uuid.UuidCreator;
|
import com.github.f4b6a3.uuid.UuidCreator;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.ConcurrentMap;
|
import java.util.concurrent.ConcurrentMap;
|
||||||
@ -15,13 +16,13 @@ public class UUIDCreatorBenchmark {
|
|||||||
|
|
||||||
int threadCount = 128;
|
int threadCount = 128;
|
||||||
int iterationCount = 100_000;
|
int iterationCount = 100_000;
|
||||||
ConcurrentMap<UUID, Long> uuidMap = new ConcurrentHashMap<>();
|
Map<UUID, Long> uuidMap = new ConcurrentHashMap<>();
|
||||||
AtomicLong collisionCount = new AtomicLong();
|
AtomicLong collisionCount = new AtomicLong();
|
||||||
long startNanos = System.nanoTime();
|
long startNanos = System.nanoTime();
|
||||||
CountDownLatch endLatch = new CountDownLatch(threadCount);
|
CountDownLatch endLatch = new CountDownLatch(threadCount);
|
||||||
|
|
||||||
for (long i = 0; i < threadCount; i++) {
|
for (long i = 0; i < threadCount; i++) {
|
||||||
final long threadId = i;
|
long threadId = i;
|
||||||
new Thread(() -> {
|
new Thread(() -> {
|
||||||
for (long j = 0; j < iterationCount; j++) {
|
for (long j = 0; j < iterationCount; j++) {
|
||||||
UUID uuid = UuidCreator.getTimeBased();
|
UUID uuid = UuidCreator.getTimeBased();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user