Reduce log-presence of the ClassNotFound error for RemovelCause on forge

This commit is contained in:
Lukas Rieger (Blue) 2022-01-22 23:22:42 +01:00
parent db1794aa38
commit 3f634974bc
No known key found for this signature in database
GPG Key ID: 2D09EC5ED2687FF2

View File

@ -24,20 +24,15 @@
*/
package de.bluecolored.bluemap.core;
import com.github.benmanes.caffeine.cache.RemovalCause;
import de.bluecolored.bluemap.core.logger.Logger;
import org.spongepowered.configurate.ConfigurationNode;
import org.spongepowered.configurate.gson.GsonConfigurationLoader;
import java.io.IOException;
import java.util.UUID;
import java.util.concurrent.ForkJoinPool;
public class BlueMap {
// early-loading this class, to fix a classloading issue
private static final RemovalCause RC = null;
public static final String VERSION, GIT_HASH, GIT_CLEAN;
static {
String version = "DEV", gitHash = "DEV", gitClean = "DEV";
@ -63,6 +58,17 @@ public class BlueMap {
GIT_CLEAN = gitClean;
}
public static final ForkJoinPool THREAD_POOL = new ForkJoinPool();
public static final ForkJoinPool THREAD_POOL = new ForkJoinPool(
Runtime.getRuntime().availableProcessors(),
ForkJoinPool.defaultForkJoinWorkerThreadFactory,
(thread, ex) -> {
if (ex instanceof ClassNotFoundException && ex.getMessage().contains("RemovalCause")) {
Logger.global.noFloodWarning("RemovalCauseError", ex.getMessage());
} else {
Logger.global.logError("Something went wrong!", ex);
}
},
false
);
}