mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-18 00:25:39 +01:00
01a13871de
Patch documentation to come Issues with the old system that are fixed now: - World generation does not scale with cpu cores effectively. - Relies on the main thread for scheduling and maintaining chunk state, dropping chunk load/generate rates at lower tps. - Unreliable prioritisation of chunk gen/load calls that block the main thread. - Shutdown logic is utterly unreliable, as it has to wait for all chunks to unload - is it guaranteed that the chunk system is in a state on shutdown that it can reliably do this? Watchdog shutdown also typically failed due to thread checks, which is now resolved. - Saving of data is not unified (i.e can save chunk data without saving entity data, poses problems for desync if shutdown is really abnormal. - Entities are not loaded with chunks. This caused quite a bit of headache for Chunk#getEntities API, but now the new chunk system loads entities with chunks so that they are ready whenever the chunk loads in. Effectively brings the behavior back to 1.16 era, but still storing entities in their own separate regionfiles. The above list is not complete. The patch documentation will complete it. New chunk system hard relies on starlight and dataconverter, and most importantly the new concurrent utilities in ConcurrentUtil. Some of the old async chunk i/o interface (i.e the old file io thread reroutes _some_ calls to the new file io thread) is kept for plugin compat reasons. It will be removed in the next major version of minecraft. The old legacy chunk system patches have been moved to the removed folder in case we need them again.
40 lines
2.2 KiB
Diff
40 lines
2.2 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Aikar <aikar@aikar.co>
|
|
Date: Sun, 12 Aug 2018 02:33:39 -0400
|
|
Subject: [PATCH] Use a Queue for Queueing Commands
|
|
|
|
Lists are bad as Queues mmmkay.
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
|
index 0944d339c76b09f183b3a1e191955300fc24cd97..b23905e5d2d1e8300c710df2aeb370fd4af8ac76 100644
|
|
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
|
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
|
@@ -74,7 +74,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
|
static final Logger LOGGER = LogUtils.getLogger();
|
|
private static final int CONVERSION_RETRY_DELAY_MS = 5000;
|
|
private static final int CONVERSION_RETRIES = 2;
|
|
- private final List<ConsoleInput> consoleInput = Collections.synchronizedList(Lists.newArrayList());
|
|
+ private final java.util.Queue<ConsoleInput> serverCommandQueue = new java.util.concurrent.ConcurrentLinkedQueue<>(); // Paper - use a proper queuemmands
|
|
@Nullable
|
|
private QueryThreadGs4 queryThreadGs4;
|
|
public final RconConsoleSource rconConsoleSource;
|
|
@@ -446,13 +446,15 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
|
return;
|
|
}
|
|
// Paper end - rewrite chunk system
|
|
- this.consoleInput.add(new ConsoleInput(command, commandSource));
|
|
+ this.serverCommandQueue.add(new ConsoleInput(command, commandSource)); // Paper - use proper queue
|
|
}
|
|
|
|
public void handleConsoleInputs() {
|
|
MinecraftTimings.serverCommandTimer.startTiming(); // Spigot
|
|
- while (!this.consoleInput.isEmpty()) {
|
|
- ConsoleInput servercommand = (ConsoleInput) this.consoleInput.remove(0);
|
|
+ // Paper start - use proper queue
|
|
+ ConsoleInput servercommand;
|
|
+ while ((servercommand = this.serverCommandQueue.poll()) != null) {
|
|
+ // Paper end
|
|
|
|
// CraftBukkit start - ServerCommand for preprocessing
|
|
ServerCommandEvent event = new ServerCommandEvent(console, servercommand.msg);
|