Improve uuid cache load times (#5143)

This commit is contained in:
Warrior 2022-11-04 01:14:18 +01:00 committed by GitHub
parent 20011b9996
commit 22a0d53cf2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -16,7 +16,6 @@ import java.util.Map;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArraySet;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
@ -42,7 +41,7 @@ public class ModernUUIDCache {
* caching the {@code last-account-name} value.
*/
private final ConcurrentHashMap<String, UUID> nameToUuidMap = new ConcurrentHashMap<>();
private final CopyOnWriteArraySet<UUID> uuidCache = new CopyOnWriteArraySet<>();
private final Set<UUID> uuidCache = ConcurrentHashMap.newKeySet();
private final ScheduledExecutorService writeExecutor = Executors.newSingleThreadScheduledExecutor();
private final AtomicBoolean pendingNameWrite = new AtomicBoolean(false);