Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-11-15 20:40:07 +01:00
bc0dd0df3d
Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: 716b4fce Revert SnakeYAML upgrade ca6f8942 Update to Minecraft 1.18-rc3 57e7e952 #683: Add Player#showDemoScreen CraftBukkit Changes: c98abfb0 Update to Minecraft 1.18-rc3 9b258501 #960: Add Player#showDemoScreen d9542247 Produce remapped jars after bootstrap jar 99f3ddde SPIGOT-6808: Fix RegionAccessor#getBiome Spigot Changes: b7a4222e Update to Minecraft 1.18-rc3
49 Zeilen
2.3 KiB
Diff
49 Zeilen
2.3 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Spottedleaf <spottedleaf@spottedleaf.dev>
|
|
Date: Fri, 24 Apr 2020 09:06:15 -0700
|
|
Subject: [PATCH] Make CallbackExecutor strict again
|
|
|
|
The correct fix for double scheduling is to avoid it. The reason
|
|
this class is used is because double scheduling causes issues
|
|
elsewhere, and it acts as an explicit detector of what double
|
|
schedules. Effectively, use the callback executor as a tool of
|
|
finding issues rather than hiding these issues.
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
|
index d9f6d47629f2f4aa1db5a19b8cb7229a0905b75e..dec387e56928fa9b07a183e3055489dfe3dd94fe 100644
|
|
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
|
|
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
|
@@ -160,17 +160,28 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
|
public final CallbackExecutor callbackExecutor = new CallbackExecutor();
|
|
public static final class CallbackExecutor implements java.util.concurrent.Executor, Runnable {
|
|
|
|
- private final java.util.Queue<Runnable> queue = new java.util.ArrayDeque<>();
|
|
+ private Runnable queued; // Paper - revert CB changes
|
|
|
|
@Override
|
|
public void execute(Runnable runnable) {
|
|
- this.queue.add(runnable);
|
|
+ // Paper start - revert CB changes
|
|
+ org.spigotmc.AsyncCatcher.catchOp("Callback Executor execute");
|
|
+ if (this.queued != null) {
|
|
+ net.minecraft.server.MinecraftServer.LOGGER.fatal("Failed to schedule runnable", new IllegalStateException("Already queued"));
|
|
+ throw new IllegalStateException("Already queued");
|
|
+ }
|
|
+ this.queued = runnable;
|
|
+ // Paper end - revert CB changes
|
|
}
|
|
|
|
@Override
|
|
public void run() {
|
|
- Runnable task;
|
|
- while ((task = this.queue.poll()) != null) {
|
|
+ // Paper start - revert CB changes
|
|
+ org.spigotmc.AsyncCatcher.catchOp("Callback Executor execute");
|
|
+ Runnable task = this.queued;
|
|
+ if (task != null) {
|
|
+ this.queued = null;
|
|
+ // Paper end - revert CB changes
|
|
task.run();
|
|
}
|
|
}
|