Use dedicated thread for main thread blocking chunk loads

In most cases, this change won't benefit much. However, there
exists the possibility that your Chunk Task threads are all busy
doing super slow work such as converting chunks.

If this occurs, the main thread blocking tasks, even at highest priority,
has to wait for some thread to become available.

This change gives us a waiting thread used only for main thread blocking
tasks, as well as an increased thread priority level, so that the OS
will give priority to this thread over the other threads.

This is more about guarantees, and won't be any real performanc boost
to anyone who has low or fast activity on their chunk tasks anyways.

But not all of us force upgrade our worlds, and this can be a life saver.

also reordered some patches because multiple PR's were merged.
This commit is contained in:
Aikar 2020-04-11 04:40:00 -04:00
parent 588b62e47b
commit fce69af70c
No known key found for this signature in database
GPG key ID: 401ADFC9891FAAFE
4 changed files with 104 additions and 42 deletions

View file

@ -1,4 +1,4 @@
From 4cafe0ab6318dce5b1775e57728b433bf581267d Mon Sep 17 00:00:00 2001
From a5bc4ab211dd7d61537cf330e7092ec28ba18733 Mon Sep 17 00:00:00 2001
From: JRoy <joshroy126@gmail.com>
Date: Fri, 10 Apr 2020 21:24:35 -0400
Subject: [PATCH] Expose MinecraftServer#isRunning
@ -6,10 +6,10 @@ Subject: [PATCH] Expose MinecraftServer#isRunning
This allows for plugins to detect if the server is actually turning off in onDisable rather than just plugins reloading.
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index b9973406..dda12412 100644
index c3c2d9c6b..ea3e5d6fa 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -1661,6 +1661,15 @@ public final class Bukkit {
@@ -1680,6 +1680,15 @@ public final class Bukkit {
public static int getCurrentTick() {
return server.getCurrentTick();
}
@ -26,10 +26,10 @@ index b9973406..dda12412 100644
@NotNull
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 80f9abdc..5758ae79 100644
index bfa83c9bb..9ceaac0e8 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -1455,5 +1455,12 @@ public interface Server extends PluginMessageRecipient {
@@ -1470,5 +1470,12 @@ public interface Server extends PluginMessageRecipient {
* @return Current tick
*/
int getCurrentTick();
@ -43,5 +43,5 @@ index 80f9abdc..5758ae79 100644
// Paper end
}
--
2.17.1
2.25.1