diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/auth/profiles/LocalProfilesProvider.java b/LaunchServer/src/main/java/pro/gravit/launchserver/auth/profiles/LocalProfilesProvider.java index cd5faec3..465be775 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/auth/profiles/LocalProfilesProvider.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/auth/profiles/LocalProfilesProvider.java @@ -182,7 +182,7 @@ private void writeCache(Path file) throws IOException { } private void readCache(Path file) throws IOException { - Map updatesDirMap = new HashMap<>(16); + Map updatesDirMap = new ConcurrentHashMap<>(16); try (HInput input = new HInput(IOHelper.newInput(file))) { int size = input.readLength(0); for (int i = 0; i < size; ++i) { @@ -192,7 +192,7 @@ private void readCache(Path file) throws IOException { } } logger.debug("Found {} updates from cache", updatesDirMap.size()); - this.updatesDirMap = Collections.unmodifiableMap(updatesDirMap); + this.updatesDirMap = updatesDirMap; } public void readProfilesDir() throws IOException { @@ -248,7 +248,7 @@ public void sync(Collection dirs) throws IOException { newUpdatesDirMap.put(name, updateHDir); } } - updatesDirMap = Collections.unmodifiableMap(newUpdatesDirMap); + updatesDirMap = newUpdatesDirMap; if (cacheUpdates) { try { writeCache(Path.of(cacheFile));