Add mitigation for JDK-8274349 (#4711)

This commit is contained in:
Josh Roy 2021-12-24 21:40:41 -05:00 committed by GitHub
parent 84326cf13e
commit 5f98d3fac5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -36,6 +36,13 @@ public class EssentialsDiscord extends JavaPlugin implements IEssentialsModule {
getLogger().log(Level.WARNING, tl("versionMismatchAll")); getLogger().log(Level.WARNING, tl("versionMismatchAll"));
} }
// JDK-8274349 - Mitigation for a regression in Java 17 on 1 core systems which was fixed in 17.0.2
final String[] javaVersion = System.getProperty("java.version").split("\\.");
if (Runtime.getRuntime().availableProcessors() <= 1 && javaVersion[0].startsWith("17") && (javaVersion.length < 2 || (javaVersion[1].equals("0") && javaVersion[2].startsWith("1")))) {
logger.log(Level.INFO, "Essentials is mitigating JDK-8274349");
System.setProperty("java.util.concurrent.ForkJoinPool.common.parallelism", "1");
}
isPAPI = getServer().getPluginManager().getPlugin("PlaceholderAPI") != null; isPAPI = getServer().getPluginManager().getPlugin("PlaceholderAPI") != null;
settings = new DiscordSettings(this); settings = new DiscordSettings(this);