mirror of
https://github.com/BlueMap-Minecraft/BlueMap.git
synced 2025-01-14 12:11:46 +01:00
Use own ForkJoinPool for cache-cleanups to avoid class-loading errors
On forge there was a problem sometimes, where presumably a join-fork-thread was created with a class-loader that did not have access to all classes, and therefore crashed in a ClassNotFoundException. This fixes this issue.
This commit is contained in:
parent
51367bfab9
commit
e9ab39c052
@ -25,6 +25,7 @@
|
||||
package de.bluecolored.bluemap.core;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.concurrent.ForkJoinPool;
|
||||
|
||||
import de.bluecolored.bluemap.core.logger.Logger;
|
||||
import ninja.leaping.configurate.gson.GsonConfigurationLoader;
|
||||
@ -45,4 +46,6 @@ public class BlueMap {
|
||||
VERSION = version;
|
||||
}
|
||||
|
||||
public static final ForkJoinPool THREAD_POOL = new ForkJoinPool();
|
||||
|
||||
}
|
||||
|
@ -33,6 +33,7 @@
|
||||
import com.google.common.collect.MultimapBuilder;
|
||||
import com.google.common.collect.Multimaps;
|
||||
|
||||
import de.bluecolored.bluemap.core.BlueMap;
|
||||
import de.bluecolored.bluemap.core.logger.Logger;
|
||||
import de.bluecolored.bluemap.core.mca.mapping.BlockPropertiesMapper;
|
||||
import de.bluecolored.bluemap.core.resourcepack.NoSuchResourceException;
|
||||
@ -79,6 +80,7 @@ public BlockPropertiesConfig(ConfigurationNode node, ResourcePack resourcePack,
|
||||
}
|
||||
|
||||
mappingCache = Caffeine.newBuilder()
|
||||
.executor(BlueMap.THREAD_POOL)
|
||||
.maximumSize(10000)
|
||||
.build(key -> mapNoCache(key));
|
||||
}
|
||||
|
@ -29,6 +29,8 @@
|
||||
import com.github.benmanes.caffeine.cache.Cache;
|
||||
import com.github.benmanes.caffeine.cache.Caffeine;
|
||||
|
||||
import de.bluecolored.bluemap.core.BlueMap;
|
||||
|
||||
public abstract class AbstractLogger extends Logger {
|
||||
|
||||
private static final Object DUMMY = new Object();
|
||||
@ -37,9 +39,10 @@ public abstract class AbstractLogger extends Logger {
|
||||
|
||||
public AbstractLogger() {
|
||||
noFloodCache = Caffeine.newBuilder()
|
||||
.expireAfterWrite(1, TimeUnit.HOURS)
|
||||
.maximumSize(10000)
|
||||
.build();
|
||||
.executor(BlueMap.THREAD_POOL)
|
||||
.expireAfterWrite(1, TimeUnit.HOURS)
|
||||
.maximumSize(10000)
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -49,6 +49,7 @@
|
||||
import com.google.common.collect.Multimap;
|
||||
import com.google.common.collect.MultimapBuilder;
|
||||
|
||||
import de.bluecolored.bluemap.core.BlueMap;
|
||||
import de.bluecolored.bluemap.core.MinecraftVersion;
|
||||
import de.bluecolored.bluemap.core.logger.Logger;
|
||||
import de.bluecolored.bluemap.core.mca.extensions.BlockStateExtension;
|
||||
@ -144,6 +145,7 @@ private MCAWorld(
|
||||
registerBlockStateExtension(new DoubleChestExtension());
|
||||
|
||||
this.chunkCache = Caffeine.newBuilder()
|
||||
.executor(BlueMap.THREAD_POOL)
|
||||
.maximumSize(500)
|
||||
.expireAfterWrite(1, TimeUnit.MINUTES)
|
||||
.build(chunkPos -> this.loadChunkOrEmpty(chunkPos, 2, 1000));
|
||||
|
@ -45,6 +45,7 @@
|
||||
import de.bluecolored.bluemap.common.plugin.serverinterface.Player;
|
||||
import de.bluecolored.bluemap.common.plugin.serverinterface.ServerEventListener;
|
||||
import de.bluecolored.bluemap.common.plugin.serverinterface.ServerInterface;
|
||||
import de.bluecolored.bluemap.core.BlueMap;
|
||||
import de.bluecolored.bluemap.core.MinecraftVersion;
|
||||
import de.bluecolored.bluemap.core.logger.Logger;
|
||||
import de.bluecolored.bluemap.core.resourcepack.ParseResourceException;
|
||||
@ -83,6 +84,7 @@ public FabricMod() {
|
||||
this.worldUUIDs = new ConcurrentHashMap<>();
|
||||
this.eventForwarder = new FabricEventForwarder(this);
|
||||
this.worldUuidCache = Caffeine.newBuilder()
|
||||
.executor(BlueMap.THREAD_POOL)
|
||||
.weakKeys()
|
||||
.maximumSize(1000)
|
||||
.build(this::loadUUIDForWorld);
|
||||
|
@ -45,6 +45,7 @@
|
||||
import de.bluecolored.bluemap.common.plugin.serverinterface.Player;
|
||||
import de.bluecolored.bluemap.common.plugin.serverinterface.ServerEventListener;
|
||||
import de.bluecolored.bluemap.common.plugin.serverinterface.ServerInterface;
|
||||
import de.bluecolored.bluemap.core.BlueMap;
|
||||
import de.bluecolored.bluemap.core.MinecraftVersion;
|
||||
import de.bluecolored.bluemap.core.logger.Logger;
|
||||
import de.bluecolored.bluemap.core.resourcepack.ParseResourceException;
|
||||
@ -85,6 +86,7 @@ public FabricMod() {
|
||||
this.worldUUIDs = new ConcurrentHashMap<>();
|
||||
this.eventForwarder = new FabricEventForwarder(this);
|
||||
this.worldUuidCache = Caffeine.newBuilder()
|
||||
.executor(BlueMap.THREAD_POOL)
|
||||
.weakKeys()
|
||||
.maximumSize(1000)
|
||||
.build(this::loadUUIDForWorld);
|
||||
|
@ -45,6 +45,7 @@
|
||||
import de.bluecolored.bluemap.common.plugin.serverinterface.Player;
|
||||
import de.bluecolored.bluemap.common.plugin.serverinterface.ServerEventListener;
|
||||
import de.bluecolored.bluemap.common.plugin.serverinterface.ServerInterface;
|
||||
import de.bluecolored.bluemap.core.BlueMap;
|
||||
import de.bluecolored.bluemap.core.MinecraftVersion;
|
||||
import de.bluecolored.bluemap.core.logger.Logger;
|
||||
import de.bluecolored.bluemap.core.resourcepack.ParseResourceException;
|
||||
@ -85,6 +86,7 @@ public FabricMod() {
|
||||
this.worldUUIDs = new ConcurrentHashMap<>();
|
||||
this.eventForwarder = new FabricEventForwarder(this);
|
||||
this.worldUuidCache = Caffeine.newBuilder()
|
||||
.executor(BlueMap.THREAD_POOL)
|
||||
.weakKeys()
|
||||
.maximumSize(1000)
|
||||
.build(this::loadUUIDForWorld);
|
||||
|
@ -45,6 +45,7 @@
|
||||
import de.bluecolored.bluemap.common.plugin.serverinterface.Player;
|
||||
import de.bluecolored.bluemap.common.plugin.serverinterface.ServerEventListener;
|
||||
import de.bluecolored.bluemap.common.plugin.serverinterface.ServerInterface;
|
||||
import de.bluecolored.bluemap.core.BlueMap;
|
||||
import de.bluecolored.bluemap.core.MinecraftVersion;
|
||||
import de.bluecolored.bluemap.core.logger.Logger;
|
||||
import de.bluecolored.bluemap.core.resourcepack.ParseResourceException;
|
||||
@ -87,6 +88,7 @@ public ForgeMod() {
|
||||
this.worldUUIDs = new ConcurrentHashMap<>();
|
||||
this.eventForwarder = new ForgeEventForwarder(this);
|
||||
this.worldUuidCache = Caffeine.newBuilder()
|
||||
.executor(BlueMap.THREAD_POOL)
|
||||
.weakKeys()
|
||||
.maximumSize(1000)
|
||||
.build(this::loadUUIDForWorld);
|
||||
|
@ -45,6 +45,7 @@
|
||||
import de.bluecolored.bluemap.common.plugin.serverinterface.Player;
|
||||
import de.bluecolored.bluemap.common.plugin.serverinterface.ServerEventListener;
|
||||
import de.bluecolored.bluemap.common.plugin.serverinterface.ServerInterface;
|
||||
import de.bluecolored.bluemap.core.BlueMap;
|
||||
import de.bluecolored.bluemap.core.MinecraftVersion;
|
||||
import de.bluecolored.bluemap.core.logger.Logger;
|
||||
import de.bluecolored.bluemap.core.resourcepack.ParseResourceException;
|
||||
@ -87,6 +88,7 @@ public ForgeMod() {
|
||||
this.worldUUIDs = new ConcurrentHashMap<>();
|
||||
this.eventForwarder = new ForgeEventForwarder(this);
|
||||
this.worldUuidCache = Caffeine.newBuilder()
|
||||
.executor(BlueMap.THREAD_POOL)
|
||||
.weakKeys()
|
||||
.maximumSize(1000)
|
||||
.build(this::loadUUIDForWorld);
|
||||
|
@ -45,6 +45,7 @@
|
||||
import de.bluecolored.bluemap.common.plugin.serverinterface.Player;
|
||||
import de.bluecolored.bluemap.common.plugin.serverinterface.ServerEventListener;
|
||||
import de.bluecolored.bluemap.common.plugin.serverinterface.ServerInterface;
|
||||
import de.bluecolored.bluemap.core.BlueMap;
|
||||
import de.bluecolored.bluemap.core.MinecraftVersion;
|
||||
import de.bluecolored.bluemap.core.logger.Logger;
|
||||
import de.bluecolored.bluemap.core.resourcepack.ParseResourceException;
|
||||
@ -89,11 +90,14 @@ public ForgeMod() {
|
||||
this.worldUUIDs = new ConcurrentHashMap<>();
|
||||
this.eventForwarder = new ForgeEventForwarder(this);
|
||||
this.worldUuidCache = Caffeine.newBuilder()
|
||||
.executor(BlueMap.THREAD_POOL)
|
||||
.weakKeys()
|
||||
.maximumSize(1000)
|
||||
.build(this::loadUUIDForWorld);
|
||||
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
|
Loading…
Reference in New Issue
Block a user