Fix Caffeine using wrong thread-pool and add sorting to initial map-update

This commit is contained in:
Lukas Rieger (Blue) 2022-07-31 18:45:30 +02:00
parent cef202ebba
commit ae992419bb
No known key found for this signature in database
GPG Key ID: 2D09EC5ED2687FF2
2 changed files with 6 additions and 2 deletions

View File

@ -27,9 +27,11 @@ public class BlueMapAPIImpl extends BlueMapAPI {
public BlueMapAPIImpl(Plugin plugin) { public BlueMapAPIImpl(Plugin plugin) {
this.plugin = plugin; this.plugin = plugin;
this.worldCache = Caffeine.newBuilder() this.worldCache = Caffeine.newBuilder()
.executor(BlueMap.THREAD_POOL)
.weakKeys() .weakKeys()
.build(this::getWorldUncached); .build(this::getWorldUncached);
this.mapCache = Caffeine.newBuilder() this.mapCache = Caffeine.newBuilder()
.executor(BlueMap.THREAD_POOL)
.weakKeys() .weakKeys()
.build(this::getMapUncached); .build(this::getMapUncached);
} }

View File

@ -194,11 +194,13 @@ public void load() throws IOException {
renderManager = new RenderManager(); renderManager = new RenderManager();
//update all maps //update all maps
for (BmMap map : maps.values()) { maps.values().stream()
.sorted(Comparator.comparing(bmMap -> bmMap.getMapSettings().getSorting()))
.forEach(map -> {
if (pluginState.getMapState(map).isUpdateEnabled()) { if (pluginState.getMapState(map).isUpdateEnabled()) {
renderManager.scheduleRenderTask(new MapUpdateTask(map)); renderManager.scheduleRenderTask(new MapUpdateTask(map));
} }
} });
//start render-manager //start render-manager
if (pluginState.isRenderThreadsEnabled()) { if (pluginState.isRenderThreadsEnabled()) {