diff --git a/patches/unapplied/api/Add-more-Witch-API.patch b/patches/api/Add-more-Witch-API.patch similarity index 100% rename from patches/unapplied/api/Add-more-Witch-API.patch rename to patches/api/Add-more-Witch-API.patch diff --git a/patches/unapplied/server/Add-Velocity-IP-Forwarding-Support.patch b/patches/server/Add-Velocity-IP-Forwarding-Support.patch similarity index 100% rename from patches/unapplied/server/Add-Velocity-IP-Forwarding-Support.patch rename to patches/server/Add-Velocity-IP-Forwarding-Support.patch diff --git a/patches/unapplied/server/Add-more-Witch-API.patch b/patches/server/Add-more-Witch-API.patch similarity index 100% rename from patches/unapplied/server/Add-more-Witch-API.patch rename to patches/server/Add-more-Witch-API.patch diff --git a/patches/unapplied/server/Add-option-to-prevent-players-from-moving-into-unloa.patch b/patches/server/Add-option-to-prevent-players-from-moving-into-unloa.patch similarity index 100% rename from patches/unapplied/server/Add-option-to-prevent-players-from-moving-into-unloa.patch rename to patches/server/Add-option-to-prevent-players-from-moving-into-unloa.patch diff --git a/patches/unapplied/server/Check-Drowned-for-Villager-Aggression-Config.patch b/patches/server/Check-Drowned-for-Villager-Aggression-Config.patch similarity index 100% rename from patches/unapplied/server/Check-Drowned-for-Villager-Aggression-Config.patch rename to patches/server/Check-Drowned-for-Villager-Aggression-Config.patch diff --git a/patches/unapplied/server/Don-t-sleep-after-profile-lookups-if-not-needed.patch b/patches/server/Don-t-sleep-after-profile-lookups-if-not-needed.patch similarity index 100% rename from patches/unapplied/server/Don-t-sleep-after-profile-lookups-if-not-needed.patch rename to patches/server/Don-t-sleep-after-profile-lookups-if-not-needed.patch diff --git a/patches/unapplied/server/Improve-Server-Thread-Pool-and-Thread-Priorities.patch b/patches/server/Improve-Server-Thread-Pool-and-Thread-Priorities.patch similarity index 88% rename from patches/unapplied/server/Improve-Server-Thread-Pool-and-Thread-Priorities.patch rename to patches/server/Improve-Server-Thread-Pool-and-Thread-Priorities.patch index 1fbf01599..9b2faf251 100644 --- a/patches/unapplied/server/Improve-Server-Thread-Pool-and-Thread-Priorities.patch +++ b/patches/server/Improve-Server-Thread-Pool-and-Thread-Priorities.patch @@ -15,18 +15,9 @@ diff --git a/src/main/java/net/minecraft/Util.java b/src/main/java/net/minecraft index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/Util.java +++ b/src/main/java/net/minecraft/Util.java -@@ -0,0 +0,0 @@ import java.util.stream.Stream; - import javax.annotation.Nullable; - import net.minecraft.resources.ResourceLocation; - import net.minecraft.server.Bootstrap; --import net.minecraft.util.Mth; -+import net.minecraft.server.ServerWorkerThread; - import net.minecraft.util.datafix.DataFixers; - import net.minecraft.world.level.block.state.properties.Property; - import org.apache.commons.io.IOUtils; -@@ -0,0 +0,0 @@ import org.apache.logging.log4j.Logger; - - public class Util { +@@ -0,0 +0,0 @@ public class Util { + private static final int DEFAULT_MAX_THREADS = 255; + private static final String MAX_THREADS_SYSTEM_PROPERTY = "max.bg.threads"; private static final AtomicInteger WORKER_COUNT = new AtomicInteger(1); - private static final ExecutorService BOOTSTRAP_EXECUTOR = makeExecutor("Bootstrap"); - private static final ExecutorService BACKGROUND_EXECUTOR = makeExecutor("Main"); @@ -40,7 +31,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } - private static ExecutorService makeExecutor(String name) { -- int i = Mth.clamp(Runtime.getRuntime().availableProcessors() - 1, 1, 7); +- int i = Mth.clamp(Runtime.getRuntime().availableProcessors() - 1, 1, getMaxThreads()); + private static ExecutorService makeExecutor(String s, int priorityModifier) { // Paper - add priority + // Paper start - use simpler thread pool that allows 1 thread + int i = Math.min(8, Math.max(Runtime.getRuntime().availableProcessors() - 2, 1)); @@ -52,7 +43,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } else { - executorService = new ForkJoinPool(i, (forkJoinPool) -> { - ForkJoinWorkerThread forkJoinWorkerThread = new ForkJoinWorkerThread(forkJoinPool) { -+ executorService = new java.util.concurrent.ThreadPoolExecutor(i, i,0L, TimeUnit.MILLISECONDS, new java.util.concurrent.LinkedBlockingQueue(), target -> new ServerWorkerThread(target, s, priorityModifier)); ++ executorService = new java.util.concurrent.ThreadPoolExecutor(i, i,0L, TimeUnit.MILLISECONDS, new java.util.concurrent.LinkedBlockingQueue(), target -> new net.minecraft.server.ServerWorkerThread(target, s, priorityModifier)); + } + /* @Override diff --git a/patches/unapplied/server/MC-50319-Check-other-worlds-for-shooter-of-projectil.patch b/patches/server/MC-50319-Check-other-worlds-for-shooter-of-projectil.patch similarity index 100% rename from patches/unapplied/server/MC-50319-Check-other-worlds-for-shooter-of-projectil.patch rename to patches/server/MC-50319-Check-other-worlds-for-shooter-of-projectil.patch diff --git a/patches/unapplied/server/Reset-players-airTicks-on-respawn.patch b/patches/server/Reset-players-airTicks-on-respawn.patch similarity index 100% rename from patches/unapplied/server/Reset-players-airTicks-on-respawn.patch rename to patches/server/Reset-players-airTicks-on-respawn.patch diff --git a/todo.txt b/todo.txt index 0d8e21029..d14a417b4 100644 --- a/todo.txt +++ b/todo.txt @@ -2,3 +2,4 @@ Add Timings to LevelTicks and EntityTickList Check IBlockDataList#GLOBAL_PALETTE Check if PlayerNaturallySpawnedEvent is called correctly Make sure fluids aren't completly fucked, there may be more sync loads to nuke there as well +Improve Server Thread Pool and Thread Priorities: mojang added a max thread count property