diff --git a/patches/server/Basic-PlayerProfile-API.patch b/patches/server/Basic-PlayerProfile-API.patch index 92ed87bbaf..f753bed940 100644 --- a/patches/server/Basic-PlayerProfile-API.patch +++ b/patches/server/Basic-PlayerProfile-API.patch @@ -185,7 +185,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + final CraftPlayerProfile clone = clone(); + clone.complete(true); + return clone; -+ }, Util.backgroundExecutor()); ++ }, Util.PROFILE_EXECUTOR); + } + + @Override diff --git a/patches/server/Do-not-submit-profile-lookups-to-worldgen-threads.patch b/patches/server/Do-not-submit-profile-lookups-to-worldgen-threads.patch index 7588070e4f..d24840663f 100644 --- a/patches/server/Do-not-submit-profile-lookups-to-worldgen-threads.patch +++ b/patches/server/Do-not-submit-profile-lookups-to-worldgen-threads.patch @@ -15,8 +15,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/net/minecraft/Util.java @@ -0,0 +0,0 @@ public class Util { private static final AtomicInteger WORKER_COUNT = new AtomicInteger(1); - private static final ExecutorService BOOTSTRAP_EXECUTOR = makeExecutor("Bootstrap", -2); // Paper - add -2 priority - private static final ExecutorService BACKGROUND_EXECUTOR = makeExecutor("Main", -1); // Paper - add -1 priority + private static final ExecutorService BOOTSTRAP_EXECUTOR = makeExecutor("Bootstrap"); + private static final ExecutorService BACKGROUND_EXECUTOR = makeExecutor("Main"); + // Paper start - don't submit BLOCKING PROFILE LOOKUPS to the world gen thread + public static final ExecutorService PROFILE_EXECUTOR = Executors.newFixedThreadPool(2, new java.util.concurrent.ThreadFactory() { + @@ -62,3 +62,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 Util.ifElse(profile, (profilex) -> { Property property = Iterables.getFirst(profilex.getProperties().get("textures"), (Property)null); if (property == null) { +diff --git a/src/main/java/org/bukkit/craftbukkit/profile/CraftPlayerProfile.java b/src/main/java/org/bukkit/craftbukkit/profile/CraftPlayerProfile.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/bukkit/craftbukkit/profile/CraftPlayerProfile.java ++++ b/src/main/java/org/bukkit/craftbukkit/profile/CraftPlayerProfile.java +@@ -0,0 +0,0 @@ public final class CraftPlayerProfile implements PlayerProfile { + + @Override + public CompletableFuture update() { +- return CompletableFuture.supplyAsync(this::getUpdatedProfile, Util.backgroundExecutor()); ++ return CompletableFuture.supplyAsync(this::getUpdatedProfile, Util.PROFILE_EXECUTOR); // Paper - not a good idea to use BLOCKING OPERATIONS on the worldgen executor + } + + private CraftPlayerProfile getUpdatedProfile() { diff --git a/patches/server/Improve-Server-Thread-Pool-and-Thread-Priorities.patch b/patches/server/Improve-Server-Thread-Pool-and-Thread-Priorities.patch index 44aab3b60c..dbd5bb2040 100644 --- a/patches/server/Improve-Server-Thread-Pool-and-Thread-Priorities.patch +++ b/patches/server/Improve-Server-Thread-Pool-and-Thread-Priorities.patch @@ -23,9 +23,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - private static final ExecutorService BACKGROUND_EXECUTOR = makeExecutor("Main"); + private static final ExecutorService BOOTSTRAP_EXECUTOR = makeExecutor("Bootstrap", -2); // Paper - add -2 priority + private static final ExecutorService BACKGROUND_EXECUTOR = makeExecutor("Main", -1); // Paper - add -1 priority - private static final ExecutorService IO_POOL = makeIoExecutor(); - public static LongSupplier timeSource = System::nanoTime; - public static final Ticker TICKER = new Ticker() { + // Paper start - don't submit BLOCKING PROFILE LOOKUPS to the world gen thread + public static final ExecutorService PROFILE_EXECUTOR = Executors.newFixedThreadPool(2, new java.util.concurrent.ThreadFactory() { + @@ -0,0 +0,0 @@ public class Util { return Instant.now().toEpochMilli(); }