2015-05-25 14:05:40 +02:00
|
|
|
From 1f925e84e012fe5971f7811c32c597bc0f8f96fa Mon Sep 17 00:00:00 2001
|
2015-04-19 12:20:50 +02:00
|
|
|
From: md_5 <git@md-5.net>
|
|
|
|
Date: Sun, 19 Apr 2015 09:19:39 +1000
|
|
|
|
Subject: [PATCH] Use CLQ for main thread tasks.
|
|
|
|
|
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
2015-05-25 14:05:40 +02:00
|
|
|
index 8b95e59..811dcf1 100644
|
2015-04-19 12:20:50 +02:00
|
|
|
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
|
|
@@ -104,7 +104,7 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs
|
|
|
|
private long X = 0L;
|
|
|
|
private final GameProfileRepository Y;
|
|
|
|
private final UserCache Z;
|
|
|
|
- protected final Queue<FutureTask<?>> j = Queues.newArrayDeque();
|
|
|
|
+ protected final Queue<FutureTask<?>> j = new java.util.concurrent.ConcurrentLinkedQueue<FutureTask<?>>(); // Spigot, PAIL: Rename
|
|
|
|
private Thread serverThread;
|
2015-05-09 22:23:26 +02:00
|
|
|
private long ab = az();
|
2015-04-19 12:20:50 +02:00
|
|
|
|
2015-05-09 22:23:26 +02:00
|
|
|
@@ -711,11 +711,13 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs
|
2015-04-19 12:20:50 +02:00
|
|
|
this.methodProfiler.a("jobs");
|
|
|
|
Queue queue = this.j;
|
|
|
|
|
|
|
|
- synchronized (this.j) {
|
|
|
|
- while (!this.j.isEmpty()) {
|
|
|
|
- SystemUtils.a((FutureTask) this.j.poll(), MinecraftServer.LOGGER);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
+ // Spigot start
|
|
|
|
+ FutureTask<?> entry;
|
|
|
|
+ int count = this.j.size();
|
2015-04-20 11:11:52 +02:00
|
|
|
+ while (count-- > 0 && (entry = this.j.poll()) != null) {
|
2015-04-19 12:20:50 +02:00
|
|
|
+ SystemUtils.a(entry, MinecraftServer.LOGGER);
|
|
|
|
+ }
|
|
|
|
+ // Spigot end
|
|
|
|
|
|
|
|
this.methodProfiler.c("levels");
|
|
|
|
|
2015-05-09 22:23:26 +02:00
|
|
|
@@ -1499,10 +1501,10 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs
|
2015-04-19 12:20:50 +02:00
|
|
|
ListenableFutureTask listenablefuturetask = ListenableFutureTask.create(callable);
|
|
|
|
Queue queue = this.j;
|
|
|
|
|
|
|
|
- synchronized (this.j) {
|
|
|
|
- this.j.add(listenablefuturetask);
|
|
|
|
- return listenablefuturetask;
|
|
|
|
- }
|
|
|
|
+ // Spigot start
|
|
|
|
+ this.j.add(listenablefuturetask);
|
|
|
|
+ return listenablefuturetask;
|
|
|
|
+ // Spigot end
|
|
|
|
} else {
|
|
|
|
try {
|
|
|
|
return Futures.immediateFuture(callable.call());
|
|
|
|
--
|
2015-05-09 22:23:26 +02:00
|
|
|
2.1.4
|
2015-04-19 12:20:50 +02:00
|
|
|
|